Skip to main content

ipld_car/
lib.rs

1pub mod bounded_reader;
2pub mod car;
3#[cfg(feature = "vfs")]
4pub use car::fs::CarFs;
5pub use car::ContentAddressableArchive;
6pub mod config;
7pub use config::Config;
8pub mod dag_pb;
9pub mod error;
10pub(crate) mod proto;
11pub mod traits;
12
13#[cfg(any(test, feature = "test_helpers"))]
14pub mod test_helpers;
15
16// Helper macros
17// ============================================================================
18
19#[macro_export]
20macro_rules! fail {
21	( $y:expr ) => {{
22		return Err($y.into());
23	}};
24}
25
26#[macro_export]
27macro_rules! ensure {
28	( $x:expr) => {{
29		#[allow(clippy::neg_cmp_op_on_partial_ord)]
30		if !$x {
31			return false;
32		}
33	}};
34	( $x:expr, $y:expr $(,)? ) => {{
35		#[allow(clippy::neg_cmp_op_on_partial_ord)]
36		if !$x {
37			$crate::fail!($y);
38		}
39	}};
40}