• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bitcoindevkit / bdk / 4862317695

pending completion
4862317695

Pull #943

github

GitHub
Merge 26dc69a9c into c61995ca9
Pull Request #943: Persistance for redesigned structures.

1001 of 1001 new or added lines in 14 files covered. (100.0%)

6313 of 8865 relevant lines covered (71.21%)

34680.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.18
/crates/file_store/src/lib.rs
1
#![doc = include_str!("../README.md")]
1✔
2
mod entry_iter;
3
mod keychain_store;
4
mod store;
5
use std::io;
6

7
use bincode::{DefaultOptions, Options};
8
pub use entry_iter::*;
9
pub use keychain_store::*;
10
pub use store::*;
11

12
pub(crate) fn bincode_options() -> impl bincode::Options {
4✔
13
    DefaultOptions::new().with_varint_encoding()
4✔
14
}
4✔
15

16
/// Error that occurs due to problems encountered with the file.
17
#[derive(Debug)]
×
18
pub enum FileError {
19
    /// IO error, this may mean that the file is too short.
20
    Io(io::Error),
21
    /// Magic bytes do not match what is expected.
22
    InvalidMagicBytes {
23
        got: Vec<u8>,
24
        expected: &'static [u8],
25
    },
26
}
27

28
impl core::fmt::Display for FileError {
29
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
×
30
        match self {
×
31
            Self::Io(e) => write!(f, "io error trying to read file: {}", e),
×
32
            Self::InvalidMagicBytes { got, expected } => write!(
×
33
                f,
×
34
                "file has invalid magic bytes: expected={:?} got={:?}",
×
35
                expected, got,
×
36
            ),
×
37
        }
38
    }
×
39
}
40

41
impl From<io::Error> for FileError {
42
    fn from(value: io::Error) -> Self {
2✔
43
        Self::Io(value)
2✔
44
    }
2✔
45
}
46

47
impl std::error::Error for FileError {}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc