Skip to main content

MemorySource

Struct MemorySource 

Source
pub struct MemorySource { /* private fields */ }
Expand description

内存中的完整文件。测试与小文件场景使用。

Implementations§

Source§

impl MemorySource

Source

pub fn new(file_bytes: &[u8]) -> Result<Self>

从完整文件字节构造。

§Errors

头部解析失败或数据短于头部声明长度时返回错误。

Trait Implementations§

Source§

impl BlockSource for MemorySource

Source§

fn header(&self) -> &FixedHeader

文件头。实现者应缓存,避免每次重新解析。
Source§

fn read_ct(&self, offset: u64, len: u64) -> Result<Vec<u8>>

读取载荷区中 [offset, offset + len) 的密文。 Read more
Source§

fn ct_len(&self) -> u64

载荷区密文总长。
Source§

fn describe(&self) -> String

来源的可读描述,用于错误信息与日志。
Source§

fn is_remote(&self) -> bool

是否为远程来源。UI 据此显示网络状态、调整预读策略。
Source§

impl Debug for MemorySource

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.