pub struct Encoded {/* private fields */ }
Expand description
An encoded message.
This struct facilitates the implementation of IMAP client- and server implementations byyielding the encoding of a message throughFragment
s. This is required, because the usage ofliterals (and some other types) may change the IMAP message flow. Thus, in many cases, it is anerror to just “dump” a message and send it over the network.
§Example
useimap_codec::{ encode::{Encoder, Fragment}, imap_types::command::{Command, CommandBody}, CommandCodec,};letcmd = Command::new("A", CommandBody::login("alice","pass").unwrap()).unwrap();forfragmentinCommandCodec::default().encode(&cmd) {matchfragment { Fragment::Line { data } => {} Fragment::Literal { data, mode } => {} }}
Implementations§
Trait Implementations§
Source§implIterator forEncoded
implIterator forEncoded
Source§fnnext(&mut self) ->Option<Self::Item>
fnnext(&mut self) ->Option<Self::Item>
Advances the iterator and returns the next value.Read more
Source§fnnext_chunk<const N:usize>( &mut self,) ->Result<[Self::Item;N],IntoIter<Self::Item, N>>where Self:Sized,
fnnext_chunk<const N:usize>( &mut self,) ->Result<[Self::Item;N],IntoIter<Self::Item, N>>where Self:Sized,
🔬This is a nightly-only experimental API. (
iter_next_chunk
)Advances the iterator and returns an array containing the next
N
values.Read more1.0.0 ·Source§fnsize_hint(&self) -> (usize,Option<usize>)
fnsize_hint(&self) -> (usize,Option<usize>)
Returns the bounds on the remaining length of the iterator.Read more
1.0.0 ·Source§fncount(self) ->usizewhere Self:Sized,
fncount(self) ->usizewhere Self:Sized,
Consumes the iterator, counting the number of iterations and returning it.Read more
1.0.0 ·Source§fnlast(self) ->Option<Self::Item>where Self:Sized,
fnlast(self) ->Option<Self::Item>where Self:Sized,
Consumes the iterator, returning the last element.Read more
Source§fnadvance_by(&mut self, n:usize) ->Result<(),NonZero<usize>>
fnadvance_by(&mut self, n:usize) ->Result<(),NonZero<usize>>
🔬This is a nightly-only experimental API. (
iter_advance_by
)Advances the iterator by
n
elements.Read more1.0.0 ·Source§fnnth(&mut self, n:usize) ->Option<Self::Item>
fnnth(&mut self, n:usize) ->Option<Self::Item>
Returns the
n
th element of the iterator.Read more1.28.0 ·Source§fnstep_by(self, step:usize) ->StepBy<Self>where Self:Sized,
fnstep_by(self, step:usize) ->StepBy<Self>where Self:Sized,
Creates an iterator starting at the same point, but stepping bythe given amount at each iteration.Read more
1.0.0 ·Source§fnchain<U>(self, other: U) ->Chain<Self, <U asIntoIterator>::IntoIter>
fnchain<U>(self, other: U) ->Chain<Self, <U asIntoIterator>::IntoIter>
Takes two iterators and creates a new iterator over both in sequence.Read more
1.0.0 ·Source§fnzip<U>(self, other: U) ->Zip<Self, <U asIntoIterator>::IntoIter>where Self:Sized, U:IntoIterator,
fnzip<U>(self, other: U) ->Zip<Self, <U asIntoIterator>::IntoIter>where Self:Sized, U:IntoIterator,
‘Zips up’ two iterators into a single iterator of pairs.Read more
Source§fnintersperse(self, separator: Self::Item) ->Intersperse<Self>
fnintersperse(self, separator: Self::Item) ->Intersperse<Self>
🔬This is a nightly-only experimental API. (
iter_intersperse
)Creates a new iterator which places a copy of
separator
between adjacentitems of the original iterator.Read moreSource§fnintersperse_with<G>(self, separator: G) ->IntersperseWith<Self, G>
fnintersperse_with<G>(self, separator: G) ->IntersperseWith<Self, G>
🔬This is a nightly-only experimental API. (
iter_intersperse
)Creates a new iterator which places an item generated by
separator
between adjacent items of the original iterator.Read more1.0.0 ·Source§fnmap<B, F>(self, f: F) ->Map<Self, F>
fnmap<B, F>(self, f: F) ->Map<Self, F>
Takes a closure and creates an iterator which calls that closure on eachelement.Read more
1.0.0 ·Source§fnfilter<P>(self, predicate: P) ->Filter<Self, P>
fnfilter<P>(self, predicate: P) ->Filter<Self, P>
Creates an iterator which uses a closure to determine if an elementshould be yielded.Read more
1.0.0 ·Source§fnfilter_map<B, F>(self, f: F) ->FilterMap<Self, F>
fnfilter_map<B, F>(self, f: F) ->FilterMap<Self, F>
Creates an iterator that both filters and maps.Read more
1.0.0 ·Source§fnenumerate(self) ->Enumerate<Self>where Self:Sized,
fnenumerate(self) ->Enumerate<Self>where Self:Sized,
Creates an iterator which gives the current iteration count as well asthe next value.Read more
1.0.0 ·Source§fnskip_while<P>(self, predicate: P) ->SkipWhile<Self, P>
fnskip_while<P>(self, predicate: P) ->SkipWhile<Self, P>
1.0.0 ·Source§fntake_while<P>(self, predicate: P) ->TakeWhile<Self, P>
fntake_while<P>(self, predicate: P) ->TakeWhile<Self, P>
Creates an iterator that yields elements based on a predicate.Read more
1.57.0 ·Source§fnmap_while<B, P>(self, predicate: P) ->MapWhile<Self, P>
fnmap_while<B, P>(self, predicate: P) ->MapWhile<Self, P>
Creates an iterator that both yields elements based on a predicate and maps.Read more
1.0.0 ·Source§fnskip(self, n:usize) ->Skip<Self>where Self:Sized,
fnskip(self, n:usize) ->Skip<Self>where Self:Sized,
Creates an iterator that skips the first
n
elements.Read more1.0.0 ·Source§fntake(self, n:usize) ->Take<Self>where Self:Sized,
fntake(self, n:usize) ->Take<Self>where Self:Sized,
Creates an iterator that yields the first
n
elements, or fewerif the underlying iterator ends sooner.Read more1.0.0 ·Source§fnflat_map<U, F>(self, f: F) ->FlatMap<Self, U, F>
fnflat_map<U, F>(self, f: F) ->FlatMap<Self, U, F>
Creates an iterator that works like map, but flattens nested structure.Read more
Source§fnmap_windows<F, R, const N:usize>(self, f: F) ->MapWindows<Self, F, N>
fnmap_windows<F, R, const N:usize>(self, f: F) ->MapWindows<Self, F, N>
🔬This is a nightly-only experimental API. (
iter_map_windows
)Calls the given function
f
for each contiguous window of sizeN
overself
and returns an iterator over the outputs off
. Likeslice::windows()
,the windows during mapping overlap as well.Read more1.0.0 ·Source§fninspect<F>(self, f: F) ->Inspect<Self, F>
fninspect<F>(self, f: F) ->Inspect<Self, F>
Does something with each element of an iterator, passing the value on.Read more
1.0.0 ·Source§fnby_ref(&mut self) -> &mut Selfwhere Self:Sized,
fnby_ref(&mut self) -> &mut Selfwhere Self:Sized,
Creates a “by reference” adapter for this instance of
Iterator
.Read moreSource§fncollect_into<E>(self, collection:&mut E) ->&mut E
fncollect_into<E>(self, collection:&mut E) ->&mut E
🔬This is a nightly-only experimental API. (
iter_collect_into
)Collects all the items from an iterator into a collection.Read more
1.0.0 ·Source§fnpartition<B, F>(self, f: F) ->(B, B)
fnpartition<B, F>(self, f: F) ->(B, B)
Consumes an iterator, creating two collections from it.Read more
Source§fnis_partitioned<P>(self, predicate: P) ->bool
fnis_partitioned<P>(self, predicate: P) ->bool
🔬This is a nightly-only experimental API. (
iter_is_partitioned
)Checks if the elements of this iterator are partitioned according to the given predicate,such that all those that return
true
precede all those that returnfalse
.Read more1.27.0 ·Source§fntry_fold<B, F, R>(&mut self, init: B, f: F) -> R
fntry_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returnssuccessfully, producing a single, final value.Read more
1.27.0 ·Source§fntry_for_each<F, R>(&mut self, f: F) -> R
fntry_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in theiterator, stopping at the first error and returning that error.Read more
1.0.0 ·Source§fnfold<B, F>(self, init: B, f: F) -> B
fnfold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,returning the final result.Read more
1.51.0 ·Source§fnreduce<F>(self, f: F) ->Option<Self::Item>
fnreduce<F>(self, f: F) ->Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducingoperation.Read more
Source§fntry_reduce<R>( &mut self, f: implFnMut(Self::Item, Self::Item) -> R,) -> <<R asTry>::Residual asResidual<Option<<R asTry>::Output>>>::TryType
fntry_reduce<R>( &mut self, f: implFnMut(Self::Item, Self::Item) -> R,) -> <<R asTry>::Residual asResidual<Option<<R asTry>::Output>>>::TryType
🔬This is a nightly-only experimental API. (
iterator_try_reduce
)Reduces the elements to a single one by repeatedly applying a reducing operation. If theclosure returns a failure, the failure is propagated back to the caller immediately.Read more
1.0.0 ·Source§fnall<F>(&mut self, f: F) ->bool
fnall<F>(&mut self, f: F) ->bool
Tests if every element of the iterator matches a predicate.Read more
1.0.0 ·Source§fnany<F>(&mut self, f: F) ->bool
fnany<F>(&mut self, f: F) ->bool
Tests if any element of the iterator matches a predicate.Read more
1.0.0 ·Source§fnfind<P>(&mut self, predicate: P) ->Option<Self::Item>
fnfind<P>(&mut self, predicate: P) ->Option<Self::Item>
Searches for an element of an iterator that satisfies a predicate.Read more
1.30.0 ·Source§fnfind_map<B, F>(&mut self, f: F) ->Option<B>
fnfind_map<B, F>(&mut self, f: F) ->Option<B>
Applies function to the elements of iterator and returnsthe first non-none result.Read more
Source§fntry_find<R>( &mut self, f: implFnMut(&Self::Item) -> R,) -> <<R asTry>::Residual asResidual<Option<Self::Item>>>::TryType
fntry_find<R>( &mut self, f: implFnMut(&Self::Item) -> R,) -> <<R asTry>::Residual asResidual<Option<Self::Item>>>::TryType
🔬This is a nightly-only experimental API. (
try_find
)Applies function to the elements of iterator and returnsthe first true result or the first error.Read more
1.0.0 ·Source§fnposition<P>(&mut self, predicate: P) ->Option<usize>
fnposition<P>(&mut self, predicate: P) ->Option<usize>
Searches for an element in an iterator, returning its index.Read more
1.6.0 ·Source§fnmax_by_key<B, F>(self, f: F) ->Option<Self::Item>
fnmax_by_key<B, F>(self, f: F) ->Option<Self::Item>
Returns the element that gives the maximum value from thespecified function.Read more
1.15.0 ·Source§fnmax_by<F>(self, compare: F) ->Option<Self::Item>
fnmax_by<F>(self, compare: F) ->Option<Self::Item>
Returns the element that gives the maximum value with respect to thespecified comparison function.Read more
1.6.0 ·Source§fnmin_by_key<B, F>(self, f: F) ->Option<Self::Item>
fnmin_by_key<B, F>(self, f: F) ->Option<Self::Item>
Returns the element that gives the minimum value from thespecified function.Read more
1.15.0 ·Source§fnmin_by<F>(self, compare: F) ->Option<Self::Item>
fnmin_by<F>(self, compare: F) ->Option<Self::Item>
Returns the element that gives the minimum value with respect to thespecified comparison function.Read more
1.0.0 ·Source§fnunzip<A, B, FromA, FromB>(self) ->(FromA, FromB)
fnunzip<A, B, FromA, FromB>(self) ->(FromA, FromB)
Converts an iterator of pairs into a pair of containers.Read more
1.36.0 ·Source§fncopied<'a, T>(self) ->Copied<Self>
fncopied<'a, T>(self) ->Copied<Self>
Creates an iterator which copies all of its elements.Read more
Source§fnarray_chunks<const N:usize>(self) ->ArrayChunks<Self, N>where Self:Sized,
fnarray_chunks<const N:usize>(self) ->ArrayChunks<Self, N>where Self:Sized,
🔬This is a nightly-only experimental API. (
iter_array_chunks
)Returns an iterator over
N
elements of the iterator at a time.Read more1.11.0 ·Source§fnproduct<P>(self) -> P
fnproduct<P>(self) -> P
Iterates over the entire iterator, multiplying all the elementsRead more
Source§fncmp_by<I, F>(self, other: I, cmp: F) ->Ordering
fncmp_by<I, F>(self, other: I, cmp: F) ->Ordering
🔬This is a nightly-only experimental API. (
iter_order_by
)Lexicographically compares the elements of this
Iterator
with thoseof another with respect to the specified comparison function.Read more1.5.0 ·Source§fnpartial_cmp<I>(self, other: I) ->Option<Ordering>
fnpartial_cmp<I>(self, other: I) ->Option<Ordering>
Lexicographically compares the
PartialOrd
elements ofthisIterator
with those of another. The comparison works like short-circuitevaluation, returning a result without comparing the remaining elements.As soon as an order can be determined, the evaluation stops and a result is returned.Read moreSource§fnpartial_cmp_by<I, F>(self, other: I, partial_cmp: F) ->Option<Ordering>
fnpartial_cmp_by<I, F>(self, other: I, partial_cmp: F) ->Option<Ordering>
🔬This is a nightly-only experimental API. (
iter_order_by
)Lexicographically compares the elements of this
Iterator
with thoseof another with respect to the specified comparison function.Read moreSource§fneq_by<I, F>(self, other: I, eq: F) ->bool
fneq_by<I, F>(self, other: I, eq: F) ->bool
🔬This is a nightly-only experimental API. (
iter_order_by
)1.5.0 ·Source§fnle<I>(self, other: I) ->bool
fnle<I>(self, other: I) ->bool
Determines if the elements of this
Iterator
arelexicographicallyless or equal to those of another.Read more1.5.0 ·Source§fngt<I>(self, other: I) ->bool
fngt<I>(self, other: I) ->bool
Determines if the elements of this
Iterator
arelexicographicallygreater than those of another.Read more1.5.0 ·Source§fnge<I>(self, other: I) ->bool
fnge<I>(self, other: I) ->bool
Determines if the elements of this
Iterator
arelexicographicallygreater than or equal to those of another.Read more1.82.0 ·Source§fnis_sorted_by<F>(self, compare: F) ->bool
fnis_sorted_by<F>(self, compare: F) ->bool
Checks if the elements of this iterator are sorted using the given comparator function.Read more
1.82.0 ·Source§fnis_sorted_by_key<F, K>(self, f: F) ->bool
fnis_sorted_by_key<F, K>(self, f: F) ->bool
Checks if the elements of this iterator are sorted using the given key extractionfunction.Read more
Auto Trait Implementations§
implFreeze forEncoded
implRefUnwindSafe forEncoded
implSend forEncoded
implSync forEncoded
implUnpin forEncoded
implUnwindSafe forEncoded
Blanket Implementations§
Source§impl<T>BorrowMut<T> for Twhere T: ?Sized,
impl<T>BorrowMut<T> for Twhere T: ?Sized,
Source§fnborrow_mut(&mut self) ->&mut T
fnborrow_mut(&mut self) ->&mut T
Mutably borrows from an owned value.Read more