Struct combine::stream::SliceStream
source · pub struct SliceStream<'a, T: 'a>(pub &'a [T]);
Expand description
Newtype for constructing a stream from a slice where the items in the slice are not copyable.
Tuple Fields§
§0: &'a [T]
Trait Implementations§
source§impl<'a, T> Clone for SliceStream<'a, T>
impl<'a, T> Clone for SliceStream<'a, T>
source§fn clone(&self) -> SliceStream<'a, T>
fn clone(&self) -> SliceStream<'a, T>
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<'a, T: Debug + 'a> Debug for SliceStream<'a, T>
impl<'a, T: Debug + 'a> Debug for SliceStream<'a, T>
source§impl<'a, T> DefaultPositioned for SliceStream<'a, T>
impl<'a, T> DefaultPositioned for SliceStream<'a, T>
type Positioner = IndexPositioner
source§impl<'a, T> FullRangeStream for SliceStream<'a, T>where
T: PartialEq + 'a,
impl<'a, T> FullRangeStream for SliceStream<'a, T>where T: PartialEq + 'a,
source§impl<'a, T: Ord + 'a> Ord for SliceStream<'a, T>
impl<'a, T: Ord + 'a> Ord for SliceStream<'a, T>
source§fn cmp(&self, other: &SliceStream<'a, T>) -> Ordering
fn cmp(&self, other: &SliceStream<'a, T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'a, T: PartialEq + 'a> PartialEq for SliceStream<'a, T>
impl<'a, T: PartialEq + 'a> PartialEq for SliceStream<'a, T>
source§fn eq(&self, other: &SliceStream<'a, T>) -> bool
fn eq(&self, other: &SliceStream<'a, T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a, T: PartialOrd + 'a> PartialOrd for SliceStream<'a, T>
impl<'a, T: PartialOrd + 'a> PartialOrd for SliceStream<'a, T>
source§fn partial_cmp(&self, other: &SliceStream<'a, T>) -> Option<Ordering>
fn partial_cmp(&self, other: &SliceStream<'a, T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a, T> Positioned for SliceStream<'a, T>where
T: PartialEq + 'a,
impl<'a, T> Positioned for SliceStream<'a, T>where T: PartialEq + 'a,
source§impl<'a, T> RangeStreamOnce for SliceStream<'a, T>where
T: PartialEq + 'a,
impl<'a, T> RangeStreamOnce for SliceStream<'a, T>where T: PartialEq + 'a,
source§fn uncons_range(&mut self, size: usize) -> Result<&'a [T], StreamErrorFor<Self>>
fn uncons_range(&mut self, size: usize) -> Result<&'a [T], StreamErrorFor<Self>>
Takes
size
elements from the stream.
Fails if the length of the stream is less than size
.source§fn uncons_while<F>(&mut self, f: F) -> Result<&'a [T], StreamErrorFor<Self>>where
F: FnMut(Self::Item) -> bool,
fn uncons_while<F>(&mut self, f: F) -> Result<&'a [T], StreamErrorFor<Self>>where F: FnMut(Self::Item) -> bool,
Takes items from stream, testing each one with
predicate
.
returns the range of items which passed predicate
.source§fn uncons_while1<F>(
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>>where
F: FnMut(Self::Item) -> bool,
fn uncons_while1<F>( &mut self, f: F ) -> FastResult<Self::Range, StreamErrorFor<Self>>where F: FnMut(Self::Item) -> bool,
Takes items from stream, testing each one with
predicate
returns a range of at least one items which passed predicate
. Read moresource§impl<'a, T> Resetable for SliceStream<'a, T>
impl<'a, T> Resetable for SliceStream<'a, T>
type Checkpoint = SliceStream<'a, T>
fn checkpoint(&self) -> Self
fn reset(&mut self, checkpoint: Self)
source§impl<'a, T> StreamOnce for SliceStream<'a, T>where
T: PartialEq + 'a,
impl<'a, T> StreamOnce for SliceStream<'a, T>where T: PartialEq + 'a,
§type Range = &'a [T]
type Range = &'a [T]
The type of a range of items yielded from this stream.
Types which do not a have a way of yielding ranges of items should just use the
Self::Item
for this type.§type Position = PointerOffset
type Position = PointerOffset
Type which represents the position in a stream.
Ord
is required to allow parsers to determine which of two positions are further ahead.type Error = UnexpectedParse
source§fn uncons(&mut self) -> Result<&'a T, StreamErrorFor<Self>>
fn uncons(&mut self) -> Result<&'a T, StreamErrorFor<Self>>
Takes a stream and removes its first item, yielding the item and the rest of the elements.
Returns
Err
if no element could be retrieved.source§fn is_partial(&self) -> bool
fn is_partial(&self) -> bool
Returns
true
if this stream only contains partial input. Read moreimpl<'a, T: Copy + 'a> Copy for SliceStream<'a, T>
impl<'a, T: Eq + 'a> Eq for SliceStream<'a, T>
impl<'a, T: 'a> StructuralEq for SliceStream<'a, T>
impl<'a, T: 'a> StructuralPartialEq for SliceStream<'a, T>
Auto Trait Implementations§
impl<'a, T> RefUnwindSafe for SliceStream<'a, T>where T: RefUnwindSafe,
impl<'a, T> Send for SliceStream<'a, T>where T: Sync,
impl<'a, T> Sync for SliceStream<'a, T>where T: Sync,
impl<'a, T> Unpin for SliceStream<'a, T>
impl<'a, T> UnwindSafe for SliceStream<'a, T>where T: RefUnwindSafe,
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