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

bitcoindevkit / bdk / 13771320517

10 Mar 2025 05:47PM CUT coverage: 84.823%. Remained the same
13771320517

Pull #1883

github

web-flow
Merge 2db868fa4 into 89bd47b1a
Pull Request #1883: ci: pin `once_cell` to `1.20.3` for MSRV

12150 of 14324 relevant lines covered (84.82%)

14781.35 hits per line

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

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

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

10
pub(crate) fn bincode_options() -> impl bincode::Options {
100✔
11
    DefaultOptions::new().with_varint_encoding()
100✔
12
}
100✔
13

14
/// Error that occurs due to problems encountered with the file.
15
#[derive(Debug)]
16
pub enum StoreError {
17
    /// IO error, this may mean that the file is too short.
18
    Io(io::Error),
19
    /// Magic bytes do not match what is expected.
20
    InvalidMagicBytes { got: Vec<u8>, expected: Vec<u8> },
21
    /// Failure to decode data from the file.
22
    Bincode(bincode::ErrorKind),
23
}
24

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

39
impl From<io::Error> for StoreError {
40
    fn from(value: io::Error) -> Self {
1✔
41
        Self::Io(value)
1✔
42
    }
1✔
43
}
44

45
impl std::error::Error for StoreError {}
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