[][src]Struct abin::SegmentsSlice

pub struct SegmentsSlice<'a, TSegment> { /* fields omitted */ }

It's an implementation of SegmentIterator that does not heap-allocate. Alternatives are BinBuilder and StrBuilder; SegmentsSlice is less flexible but cheaper (smaller stack; faster).

use abin::{BinSegment, SegmentsSlice, Bin, NewBin, BinFactory, AnyBin};

let segments = &mut [BinSegment::Static("Hello, ".as_bytes()),
    BinSegment::Static("World!".as_bytes())];
let iterator = SegmentsSlice::new(segments);
let bin : Bin = NewBin::from_segments(iterator);
assert_eq!("Hello, World!".as_bytes(), bin.as_slice());

Implementations

impl<'a, TSegment> SegmentsSlice<'a, TSegment> where
    TSegment: Segment
[src]

pub fn new(slice: &'a mut [TSegment]) -> Self[src]

Important: The given slice might be modified; do not use this slice.

Trait Implementations

impl<'a, TSegment: Segment> ExactSizeIterator for SegmentsSlice<'a, TSegment>[src]

impl<'a, TSegment: Segment> Iterator for SegmentsSlice<'a, TSegment>[src]

type Item = TSegment

The type of the elements being iterated over.

impl<'a, TSegment> SegmentIterator<TSegment> for SegmentsSlice<'a, TSegment> where
    TSegment: Segment
[src]

Auto Trait Implementations

impl<'a, TSegment> RefUnwindSafe for SegmentsSlice<'a, TSegment> where
    TSegment: RefUnwindSafe

impl<'a, TSegment> Send for SegmentsSlice<'a, TSegment> where
    TSegment: Send

impl<'a, TSegment> Sync for SegmentsSlice<'a, TSegment> where
    TSegment: Sync

impl<'a, TSegment> Unpin for SegmentsSlice<'a, TSegment>

impl<'a, TSegment> !UnwindSafe for SegmentsSlice<'a, TSegment>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.