Struct pipe_chain::pipe::Repetition
source · pub struct Repetition { /* private fields */ }Expand description
Represents a range or a fixed number
the upper limit is optionally defined
Implementations§
source§impl Repetition
impl Repetition
sourcepub fn range(min: usize, max: Option<usize>) -> Result<Self, InvalidRepetition>
pub fn range(min: usize, max: Option<usize>) -> Result<Self, InvalidRepetition>
Creates a new repetition
max is inclusive
returns an error if min > max
sourcepub fn exact(n: usize) -> Result<Self, InvalidRepetition>
pub fn exact(n: usize) -> Result<Self, InvalidRepetition>
Creates a new repetition with a fixed number
sourcepub fn needs_more(&self, nb: usize) -> bool
pub fn needs_more(&self, nb: usize) -> bool
Return true if nb < min
sourcepub fn map_err<E>(
&self,
nb: usize,
f: impl FnOnce(usize, Option<usize>, usize) -> E
) -> Result<(), E>
pub fn map_err<E>( &self, nb: usize, f: impl FnOnce(usize, Option<usize>, usize) -> E ) -> Result<(), E>
Error handling
Calls the provided function f with min, max, nb if nb is outside of the repetition boundaries
sourcepub fn min_needed(&self, nb: usize) -> usize
pub fn min_needed(&self, nb: usize) -> usize
Returns the minimum number of repetitions needed after nb repetitions
Trait Implementations§
source§impl Clone for Repetition
impl Clone for Repetition
source§fn clone(&self) -> Repetition
fn clone(&self) -> Repetition
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for Repetition
impl Debug for Repetition
source§impl From<RangeFull> for Repetition
impl From<RangeFull> for Repetition
source§impl PartialEq for Repetition
impl PartialEq for Repetition
source§fn eq(&self, other: &Repetition) -> bool
fn eq(&self, other: &Repetition) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl TryFrom<RangeInclusive<usize>> for Repetition
impl TryFrom<RangeInclusive<usize>> for Repetition
§type Error = InvalidRepetition
type Error = InvalidRepetition
The type returned in the event of a conversion error.
source§impl TryFrom<RangeToInclusive<usize>> for Repetition
impl TryFrom<RangeToInclusive<usize>> for Repetition
§type Error = InvalidRepetition
type Error = InvalidRepetition
The type returned in the event of a conversion error.
source§impl TryFrom<usize> for Repetition
impl TryFrom<usize> for Repetition
impl Copy for Repetition
impl Eq for Repetition
impl StructuralEq for Repetition
impl StructuralPartialEq for Repetition
Auto Trait Implementations§
impl RefUnwindSafe for Repetition
impl Send for Repetition
impl Sync for Repetition
impl Unpin for Repetition
impl UnwindSafe for Repetition
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more