Skip to main content

ContainerEntryView

Struct ContainerEntryView 

Source
pub struct ContainerEntryView<'a, S: BlockSource> { /* private fields */ }
Expand description

容器内单个条目的视图。

把容器内某文件的 [offset, size) 映射为独立的明文流, 使容器内文件与单独加密的文件对上层完全等价—— 这是「容器内单文件预览无需解开整个容器」的实现基础(文档 05 §2.3)。

Implementations§

Source§

impl<'a, S: BlockSource> ContainerEntryView<'a, S>

Source

pub const fn new(inner: &'a S, offset: u64, size: u64) -> Self

用条目在明文载荷流中的区间构造视图。

Source

pub const fn plaintext_len(&self) -> u64

该条目的明文长度。

Source

pub fn read( &self, opened: &OpenedFile, offset: u64, length: u64, ) -> Result<Vec<u8>>

读取该条目内的明文区间。

offset 相对条目自身起点。超出条目范围的部分被裁剪, 不会读到相邻文件的数据。

§Errors

解密失败或来源读取失败时返回错误。

Trait Implementations§

Source§

impl<'a, S: Debug + BlockSource> Debug for ContainerEntryView<'a, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, S> Forget for ContainerEntryView<'a, S>

§

impl<'a, S> Freeze for ContainerEntryView<'a, S>
where &'a S: Freeze,

§

impl<'a, S> RefUnwindSafe for ContainerEntryView<'a, S>

§

impl<'a, S> Send for ContainerEntryView<'a, S>
where &'a S: Send,

§

impl<'a, S> Sync for ContainerEntryView<'a, S>
where &'a S: Sync,

§

impl<'a, S> Unpin for ContainerEntryView<'a, S>
where &'a S: Unpin,

§

impl<'a, S> UnsafeUnpin for ContainerEntryView<'a, S>

§

impl<'a, S> UnwindSafe for ContainerEntryView<'a, S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.