pub struct TranscodeProgress { /* private fields */ }Expand description
Counts how much work a crate::Transcoder completed before
returning.
Implementations§
Source§impl TranscodeProgress
impl TranscodeProgress
Sourcepub const fn new(status: TranscodeStatus, read: usize, written: usize) -> Self
pub const fn new(status: TranscodeStatus, read: usize, written: usize) -> Self
Sourcepub const fn complete(read: usize, written: usize) -> Self
pub const fn complete(read: usize, written: usize) -> Self
Creates a completed progress value.
§Parameters
read: Number of consumed input units.written: Number of produced output units.
§Returns
Returns a progress value whose status is TranscodeStatus::Complete.
Sourcepub const fn need_input(
input_index: usize,
required: NonZeroUsize,
available: usize,
read: usize,
written: usize,
) -> Self
pub const fn need_input( input_index: usize, required: NonZeroUsize, available: usize, read: usize, written: usize, ) -> Self
Creates progress that stopped because more input is needed.
§Parameters
input_index: Absolute input boundary where conversion stopped.required: Total input units required from the current input position.available: Input units currently available at the boundary.read: Number of consumed input units.written: Number of produced output units.
§Returns
Returns a progress value with TranscodeStatus::NeedInput.
Sourcepub const fn need_output(
output_index: usize,
required: NonZeroUsize,
available: usize,
read: usize,
written: usize,
) -> Self
pub const fn need_output( output_index: usize, required: NonZeroUsize, available: usize, read: usize, written: usize, ) -> Self
Creates progress that stopped because more output capacity is needed.
§Parameters
output_index: Absolute output boundary where conversion stopped.required: Total output units required from the current output position.available: Output units currently available at the boundary.read: Number of consumed input units.written: Number of produced output units.
§Returns
Returns a progress value with TranscodeStatus::NeedOutput.
Sourcepub const fn status(self) -> TranscodeStatus
pub const fn status(self) -> TranscodeStatus
Sourcepub const fn is_complete(self) -> bool
pub const fn is_complete(self) -> bool
Returns whether conversion consumed all currently supplied input.
§Returns
Returns true when the stored status is
TranscodeStatus::Complete.
Sourcepub const fn is_need_input(self) -> bool
pub const fn is_need_input(self) -> bool
Returns whether conversion stopped because more input is needed.
§Returns
Returns true when the stored status is
TranscodeStatus::NeedInput.
Sourcepub const fn is_need_output(self) -> bool
pub const fn is_need_output(self) -> bool
Returns whether conversion stopped because more output capacity is needed.
§Returns
Returns true when the stored status is
TranscodeStatus::NeedOutput.
Sourcepub const fn read(self) -> usize
pub const fn read(self) -> usize
Returns the number of input units consumed by the call.
§Returns
Returns a count relative to the input index passed to the conversion call.
Sourcepub const fn written(self) -> usize
pub const fn written(self) -> usize
Returns the number of output units written by the call.
§Returns
Returns a count relative to the output index passed to the conversion call.
Sourcepub fn validate(
&self,
input_index: usize,
available_input: usize,
output_index: usize,
available_output: usize,
) -> Result<(), TranscodeContractError>
pub fn validate( &self, input_index: usize, available_input: usize, output_index: usize, available_output: usize, ) -> Result<(), TranscodeContractError>
Validates this progress against the call bounds supplied to a transcoder.
Buffered drivers should call this before using Self::read or
Self::written to advance unchecked input or output cursors. The
method checks relative counters, absolute status indices, and
unsatisfied NeedInput / NeedOutput requirements.
§Parameters
input_index: Input index originally passed to the transcoder.available_input: Number of input units visible frominput_index.output_index: Output index originally passed to the transcoder.available_output: Number of output slots visible fromoutput_index.
§Returns
Returns Ok(()) when progress is internally consistent with the
supplied call bounds.
§Errors
Returns TranscodeContractError when a custom transcoder reports
counters, status indices, or missing-capacity requirements that do not
match the buffers supplied by the caller.
Trait Implementations§
Source§impl Clone for TranscodeProgress
impl Clone for TranscodeProgress
Source§fn clone(&self) -> TranscodeProgress
fn clone(&self) -> TranscodeProgress
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TranscodeProgress
Source§impl Debug for TranscodeProgress
impl Debug for TranscodeProgress
impl Eq for TranscodeProgress
Source§impl PartialEq for TranscodeProgress
impl PartialEq for TranscodeProgress
Source§fn eq(&self, other: &TranscodeProgress) -> bool
fn eq(&self, other: &TranscodeProgress) -> bool
self and other values to be equal, and is used by ==.