pub struct Waj { /* private fields */ }Implementations§
Methods from Deref<Target = Container>§
Sourcepub fn pack_count(&self) -> PackCount
pub fn pack_count(&self) -> PackCount
The number of packs in the container.
Sourcepub fn get_pack(
&self,
pack_id: PackId,
) -> Result<Option<MayMissPack<&ContentPack>>, Error>
pub fn get_pack( &self, pack_id: PackId, ) -> Result<Option<MayMissPack<&ContentPack>>, Error>
Get a pack for the given pack_id.
If pack_id is not found in the manifest, return None.
As a existing pack may be actually missing, we return a MayMissPack which is kind
of option, but with a pack_info payload in the “None”
Sourcepub fn get_bytes(
&self,
content: ContentAddress,
) -> Result<Option<MayMissPack<Option<ByteRegion>>>, Error>
pub fn get_bytes( &self, content: ContentAddress, ) -> Result<Option<MayMissPack<Option<ByteRegion>>>, Error>
Get bytes associated to a content address.
This imply 2 lookups:
- One to get the pack
- One to get the bytes from the pack.
So the return value of this method is a bit complex. Classic use case, when content address come from the jubako archive itself is:
ⓘ
let bytes = container
.get_bytes(content_address)?
.and_then(|m| m.transpose())
.expect("As content address should be valid, we should have a bytes (or a MayMissPack)");
// `expect(...)` may be replaced with `or_or(SomeFormatError::new(...))?`
match bytes {
MayMissPack::FOUND(bytes) => { read_from_bytes(bytes) }
MayMissPack::MISSING(pack_info) => { display_user_pack_is_missing(pack_info) }
}Sourcepub fn get_directory_pack(&self) -> &Arc<DirectoryPack>
pub fn get_directory_pack(&self) -> &Arc<DirectoryPack>
Get the directory pack of the container
Sourcepub fn get_value_storage(&self) -> &Arc<ValueStorage>
pub fn get_value_storage(&self) -> &Arc<ValueStorage>
Get the value storage of the container
Sourcepub fn get_entry_storage(&self) -> &Arc<EntryStorage>
pub fn get_entry_storage(&self) -> &Arc<EntryStorage>
Get the entry storage of the container
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Waj
impl !RefUnwindSafe for Waj
impl Send for Waj
impl Sync for Waj
impl Unpin for Waj
impl !UnwindSafe for Waj
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> 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