Skip to main content

MuxFinish

Struct MuxFinish 

Source
#[non_exhaustive]
pub struct MuxFinish<T = Vec<u8>> { pub tail: T, pub patches: Vec<Patch>, }
Expand description

Shared completion and patch types; retained paths for media implementations. Remaining output and ordered replacements returned by a producer.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§tail: T

Bytes not yet consumed through pending_output.

§patches: Vec<Patch>

Earlier bytes to overwrite; empty for a forward-only layout.

Implementations§

Source§

impl<T> OutputFinish<T>
where T: AsRef<[u8]>,

Source

pub fn new(tail: T, patches: Vec<Patch>) -> OutputFinish<T>

The remaining bytes and the patches to apply after them.

Source

pub fn validate(&self, emitted_bytes: u64) -> Result<u64, PatchError>

Validate the complete finish before appending its tail or applying any patch. Offsets are relative to this output stream, not a surrounding file. Returns the final stream length, including the tail.

This checks ranges and arithmetic only. A writer must separately enforce its output allowance and whether its chosen layout permits patches. Overlapping patches apply in their listed order. Successful validation cannot make an external writer’s later I/O failures atomic.

Source§

impl OutputFinish

Source

pub fn apply_to(self, file: &mut Vec<u8>) -> Result<(), PatchError>

Append the tail and apply validated patches to an in-memory stream. Validation or allocation failure leaves its length and contents unchanged. Capacity may grow on success; this does not impose a memory allowance.

Trait Implementations§

Source§

impl<T> Debug for OutputFinish<T>
where T: Debug,

Source§

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

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

impl<T> Default for OutputFinish<T>
where T: Default,

Source§

fn default() -> OutputFinish<T>

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

Auto Trait Implementations§

§

impl<T> Freeze for OutputFinish<T>
where T: Freeze,

§

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

§

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

§

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

§

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

§

impl<T> UnsafeUnpin for OutputFinish<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for OutputFinish<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> 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, 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.