Skip to main content

FileBlob

Struct FileBlob 

Source
pub struct FileBlob<T>
where T: FileKind,
{ pub data: Vec<u8>, /* private fields */ }

Fields§

§data: Vec<u8>

Implementations§

Source§

impl<T> FileBlob<T>
where T: FileKind,

Source

pub const EMPTY: FileBlob<T>

Source§

impl<T> FileBlob<T>
where T: FileKind,

Source

pub fn new(data: Vec<u8>) -> FileBlob<T>

Source

pub fn is_empty(&self) -> bool

Source

pub fn mime() -> &'static str

Source

pub fn len(&self) -> usize

Trait Implementations§

Source§

impl<T> Clone for FileBlob<T>
where T: FileKind,

Source§

fn clone(&self) -> FileBlob<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for FileBlob<T>
where T: FileKind,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Default for FileBlob<T>
where T: FileKind,

Source§

fn default() -> FileBlob<T>

Returns the “default value” for a type. Read more
Source§

impl<'a, T> PartialEq<FileBlob<T>> for FileBlobView<'a, T>
where T: FileKind,

Source§

fn eq(&self, other: &FileBlob<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T> PartialEq<FileBlobView<'a, T>> for FileBlob<T>
where T: FileKind,

Source§

fn eq(&self, other: &FileBlobView<'a, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> PartialEq for FileBlob<T>
where T: FileKind,

Source§

fn eq(&self, other: &FileBlob<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T> ReadAt<'a> for FileBlob<T>
where T: FileKind,

Source§

const MODE: DataType = DataType::Offset

Whether the parent table stores this value inline or via a forward offset.
Source§

type ReadOutput = FileBlobView<'a, T>

The type returned by read_at. For scalars this is Self; for strings it is &'a str; for arrays it is ListView<'a, T>.
Source§

fn read_at(buf: &'a [u8], offset: usize) -> FileBlobView<'a, T>

Decode a value from buf at absolute byte position offset.
Source§

fn default_output() -> FileBlobView<'a, T>

Return the zero/empty default for this type’s ReadOutput. Read more
Source§

fn payload_block_end(buf: &'a [u8], pos: usize) -> usize

Returns the exclusive end address of the value whose payload starts at pos. Overridden by Table (→ view.block_end()), Struct (→ pos + size_of), and String (→ pos + 4 + length). Default returns pos (safe conservative fallback for scalars/unknown types).
Source§

fn read_with_tag_at(buf: &'a [u8], offset: usize, _tag: u8) -> Self::ReadOutput

Source§

impl<T> Serialize for FileBlob<T>
where T: FileKind,

Source§

const SIZE: usize = 4

Source§

const ALIGN: usize = 4

Source§

const MODE: DataType = DataType::Offset

Whether this value is written inline at the field position (Inline) or whether a 32-bit forward offset to the value is written instead (Offset). This constant is inspected by parent arrays and tables at compile time to choose the correct write strategy.
Source§

fn size_hint(&self) -> usize

Upper bound on the number of bytes this value and its alignment padding will consume. Used by write_to and parent tables to call ensure_capacity before entering the unchecked fast path.
Source§

fn write_to<B>(&self, buffer: &mut B) -> usize
where B: Buffer,

Write this value into buffer, calling ensure_capacity first. Returns the slot of the outermost written unit (length prefix for arrays, value start for scalars).
Source§

fn write_to_unchecked<B>(&self, buffer: &mut B) -> usize
where B: Buffer,

Write this value into buffer without checking capacity first. Read more
Source§

fn is_absent(&self) -> bool

Return true if this value is the default/zero/absent state. Read more
Source§

const ALIGNR: usize = _

Source§

const ALIGN_MASK: usize = _

Source§

fn tag(&self) -> u8

Source§

impl<T> Verify for FileBlob<T>
where T: FileKind,

Source§

const INLINE_SIZE: usize = 4

Source§

fn verify_at( buf: &[u8], offset: usize, _depth: usize, _out: &mut Vec<usize>, ) -> Result<(), VerifyError>

Verify the value at offset. Every vtable position reached during traversal is pushed onto out; duplicates are expected and deduplicated by the caller once at the end.

Auto Trait Implementations§

§

impl<T> Freeze for FileBlob<T>

§

impl<T> RefUnwindSafe for FileBlob<T>
where T: RefUnwindSafe,

§

impl<T> Send for FileBlob<T>
where T: Send,

§

impl<T> Sync for FileBlob<T>
where T: Sync,

§

impl<T> Unpin for FileBlob<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for FileBlob<T>

§

impl<T> UnwindSafe for FileBlob<T>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.