SeparatedSeqAccept

Struct SeparatedSeqAccept 

Source
pub struct SeparatedSeqAccept<'o, O, Intro, Sep> {
    pub output: &'o mut O,
    pub intro: Intro,
    pub separator: Sep,
    pub wrote_any: bool,
}
Expand description

A general purpose sequence acceptor that tracks whether any element is written and can write a separator between each element, in addition to an optional intro at the beginning.

Fields§

§output: &'o mut O

The output.

§intro: Intro

The intro. Must be writable

§separator: Sep

The separator. Must be writable

§wrote_any: bool

Whether this instance wrote anything. Should be initially set to false.

Implementations§

Source§

impl<'o, O, Intro, Sep> SeparatedSeqAccept<'o, O, Intro, Sep>

Source

pub fn new(output: &'o mut O, intro: Intro, separator: Sep) -> Self

Source§

impl<'o, O, Sep> SeparatedSeqAccept<'o, O, NoOp, Sep>

Source

pub fn no_intro(output: &'o mut O, separator: Sep) -> Self

Source§

impl<'o, O> SeparatedSeqAccept<'o, O, NoOp, Str<&'static str>>

Source

pub fn comma_separated(output: &'o mut O) -> Self

Makes a sink for sequences that separates by , .

Trait Implementations§

Source§

impl<'o, O: Debug, Intro: Debug, Sep: Debug> Debug for SeparatedSeqAccept<'o, O, Intro, Sep>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'o, O, Intro, Sep> SequenceAccept<O> for SeparatedSeqAccept<'o, O, Intro, Sep>
where O: Output, Intro: Writable<O>, Sep: Writable<O>,

Source§

async fn accept<W>(&mut self, writable: &W) -> Result<(), O::Error>
where W: Writable<O>,

Writes a single writable type to this sink.

Auto Trait Implementations§

§

impl<'o, O, Intro, Sep> Freeze for SeparatedSeqAccept<'o, O, Intro, Sep>
where Intro: Freeze, Sep: Freeze,

§

impl<'o, O, Intro, Sep> RefUnwindSafe for SeparatedSeqAccept<'o, O, Intro, Sep>
where Intro: RefUnwindSafe, Sep: RefUnwindSafe, O: RefUnwindSafe,

§

impl<'o, O, Intro, Sep> Send for SeparatedSeqAccept<'o, O, Intro, Sep>
where Intro: Send, Sep: Send, O: Send,

§

impl<'o, O, Intro, Sep> Sync for SeparatedSeqAccept<'o, O, Intro, Sep>
where Intro: Sync, Sep: Sync, O: Sync,

§

impl<'o, O, Intro, Sep> Unpin for SeparatedSeqAccept<'o, O, Intro, Sep>
where Intro: Unpin, Sep: Unpin,

§

impl<'o, O, Intro, Sep> !UnwindSafe for SeparatedSeqAccept<'o, O, Intro, Sep>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.