pub struct CarHeader {
pub version: u64,
pub roots: Vec<Cid>,
}Expand description
CAR file header containing version and root CIDs.
Fields§
§version: u64CAR format version (always 1 for CARv1).
roots: Vec<Cid>Root CIDs that represent the entry points into the DAG.
Implementations§
Source§impl CarHeader
impl CarHeader
Sourcepub fn new(roots: Vec<Cid>) -> Self
pub fn new(roots: Vec<Cid>) -> Self
Create a new CAR header with the given root CIDs.
§Arguments
roots- Vector of root CIDs
§Examples
use ipfrs_core::{CidBuilder, car::CarHeader};
let cid = CidBuilder::new().build(b"root data").unwrap();
let header = CarHeader::new(vec![cid]);
assert_eq!(header.version, 1);
assert_eq!(header.roots.len(), 1);Trait Implementations§
Auto Trait Implementations§
impl Freeze for CarHeader
impl RefUnwindSafe for CarHeader
impl Send for CarHeader
impl Sync for CarHeader
impl Unpin for CarHeader
impl UnwindSafe for CarHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more