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

bitcoindevkit / bdk / 9519613010

14 Jun 2024 04:52PM CUT coverage: 83.312% (+0.2%) from 83.064%
9519613010

Pull #1473

github

web-flow
Merge feb27df18 into bc420923c
Pull Request #1473: Remove `persist` submodule

58 of 64 new or added lines in 5 files covered. (90.63%)

1 existing line in 1 file now uncovered.

11128 of 13357 relevant lines covered (83.31%)

17626.96 hits per line

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

40.0
/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 {
920✔
11
    DefaultOptions::new().with_varint_encoding()
920✔
12
}
920✔
13

14
/// Error that occurs due to problems encountered with the file.
15
#[derive(Debug)]
16
pub enum FileError {
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
}
22

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

36
impl From<io::Error> for FileError {
37
    fn from(value: io::Error) -> Self {
2✔
38
        Self::Io(value)
2✔
39
    }
2✔
40
}
41

42
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