]> git.sesse.net Git - bcachefs-tools-debian/blob - rust-src/src/lib.rs
159d049de51feaffbd7c5619224929783451bbeb
[bcachefs-tools-debian] / rust-src / src / lib.rs
1 pub mod key;
2 pub mod logger;
3 pub mod cmd_mount;
4 pub mod cmd_list;
5
6 #[macro_export]
7 macro_rules! c_str {
8     ($lit:expr) => {
9         unsafe {
10             std::ffi::CStr::from_ptr(concat!($lit, "\0").as_ptr() as *const std::os::raw::c_char)
11                 .to_bytes_with_nul()
12                 .as_ptr() as *const std::os::raw::c_char
13         }
14     };
15 }
16
17 #[derive(Debug)]
18 struct ErrnoError(errno::Errno);
19 impl std::fmt::Display for ErrnoError {
20     fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
21         self.0.fmt(f)
22     }
23 }
24 impl std::error::Error for ErrnoError {}