pub struct TranscodeProgress { /* private fields */ }Expand description
Counts how much work a crate::BufferedTranscoder completed before returning.
Implementations§
Source§impl TranscodeProgress
impl TranscodeProgress
Sourcepub const fn new(
status: TranscodeStatus,
read: usize,
written: usize,
) -> TranscodeProgress
pub const fn new( status: TranscodeStatus, read: usize, written: usize, ) -> TranscodeProgress
Sourcepub const fn complete(read: usize, written: usize) -> TranscodeProgress
pub const fn complete(read: usize, written: usize) -> TranscodeProgress
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,
additional: NonZero<usize>,
available: usize,
read: usize,
written: usize,
) -> TranscodeProgress
pub const fn need_input( input_index: usize, additional: NonZero<usize>, available: usize, read: usize, written: usize, ) -> TranscodeProgress
Creates progress that stopped because more input is needed.
§Parameters
input_index: Absolute input boundary where conversion stopped.additional: Additional input units required to continue.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,
additional: NonZero<usize>,
available: usize,
read: usize,
written: usize,
) -> TranscodeProgress
pub const fn need_output( output_index: usize, additional: NonZero<usize>, available: usize, read: usize, written: usize, ) -> TranscodeProgress
Creates progress that stopped because more output capacity is needed.
§Parameters
output_index: Absolute output boundary where conversion stopped.additional: Additional output units required to continue.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 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 const fn with_counters(
self,
read: usize,
written: usize,
) -> TranscodeProgress
pub const fn with_counters( self, read: usize, written: usize, ) -> TranscodeProgress
Rebases read and written onto self while preserving its stop reason.
Nested engines report progress scoped to one sub-step. Callers that orchestrate several sub-steps must replace those counters with totals relative to the outer call while keeping boundary fields from the sub-step status.
§Parameters
read: Input units consumed relative to the outer call’s input index.written: Output units written relative to the outer call’s output index.
§Returns
Returns progress with the same status as self and the supplied counters.
Sourcepub const fn additional(self) -> Option<NonZero<usize>>
pub const fn additional(self) -> Option<NonZero<usize>>
Returns the additional unit count required by the reported status.
§Returns
Returns Some with a non-zero count when conversion needs more input or
output. Returns None when conversion completed.
Sourcepub const fn index(self) -> Option<usize>
pub const fn index(self) -> Option<usize>
Returns the absolute boundary index associated with this status, if any.
- For
TranscodeStatus::NeedInput, returnsinput_index. - For
TranscodeStatus::NeedOutput, returnsoutput_index. - For
TranscodeStatus::Complete, returnsNone.
§Returns
Returns the boundary index for non-complete status values.
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 ==.