SequenceAccept

Trait SequenceAccept 

Source
pub trait SequenceAccept<O: Output> {
    // Required method
    async fn accept<W>(&mut self, writable: &W) -> Result<(), O::Error>
       where W: Writable<O>;
}
Expand description

A collector for multiple writable values. This trait is the ingredient to WritableSeq that represents how the sequence is handled. For example, accept can be implemented by adding commas after each element but not the last, which can be obtained using comma_separated:


async fn write_comma_separated<O, Seq>(output: &mut O, seq: Seq) -> Result<(), O::Error> where O: Output, Seq: WritableSeq<O> {
  let mut comma_sep = SeparatedSeqAccept::comma_separated(output);
  seq.for_each(&mut comma_sep).await?;
  Ok(())
}

Required Methods§

Source

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

Writes a single writable type to this sink.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'s, S, O> SequenceAccept<O> for &'s mut S
where O: Output, S: SequenceAccept<O>,

Source§

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

Implementors§

Source§

impl<'o, O, Before, After> SequenceAccept<O> for SurroundingSeqAccept<'o, O, Before, After>
where O: Output, Before: Writable<O>, After: Writable<O>,

Source§

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

Source§

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