futures_util::compat

Struct CompatSink

source
pub struct CompatSink<T, Item> { /* private fields */ }
Available on crate features compat and sink only.
Expand description

Converts a futures 0.3 Sink into a futures 0.1 Sink.

Implementations§

source§

impl<T, Item> CompatSink<T, Item>

source

pub fn new(inner: T) -> Self

Creates a new CompatSink.

source

pub fn get_ref(&self) -> &T

Get a reference to 0.3 Sink contained within.

source

pub fn get_mut(&mut self) -> &mut T

Get a mutable reference to 0.3 Sink contained within.

source

pub fn into_inner(self) -> T

Returns the inner item.

Trait Implementations§

source§

impl<T: Debug, Item: Debug> Debug for CompatSink<T, Item>

source§

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

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

impl<T, Item> Sink for CompatSink<T, Item>
where T: Sink03<Item> + Unpin,

source§

type SinkItem = Item

The type of value that the sink accepts.
source§

type SinkError = <T as Sink<Item>>::Error

The type of value produced by the sink when an error occurs.
source§

fn start_send( &mut self, item: Self::SinkItem, ) -> StartSend01<Self::SinkItem, Self::SinkError>

Begin the process of sending a value to the sink. Read more
source§

fn poll_complete(&mut self) -> Poll01<(), Self::SinkError>

Flush all output from this sink, if necessary. Read more
source§

fn close(&mut self) -> Poll01<(), Self::SinkError>

A method to indicate that no more values will ever be pushed into this sink. Read more
source§

fn wait(self) -> Wait<Self>
where Self: Sized,

Creates a new object which will produce a synchronous sink. Read more
source§

fn with<U, F, Fut>(self, f: F) -> With<Self, U, F, Fut>
where F: FnMut(U) -> Fut, Fut: IntoFuture<Item = Self::SinkItem>, <Fut as IntoFuture>::Error: From<Self::SinkError>, Self: Sized,

Composes a function in front of the sink. Read more
source§

fn with_flat_map<U, F, St>(self, f: F) -> WithFlatMap<Self, U, F, St>
where F: FnMut(U) -> St, St: Stream<Item = Self::SinkItem, Error = Self::SinkError>, Self: Sized,

Composes a function in front of the sink. Read more
source§

fn sink_map_err<F, E>(self, f: F) -> SinkMapErr<Self, F>
where F: FnOnce(Self::SinkError) -> E, Self: Sized,

Transforms the error returned by the sink.
source§

fn sink_from_err<E>(self) -> SinkFromErr<Self, E>
where E: From<Self::SinkError>, Self: Sized,

Map this sink’s error to any error implementing From for this sink’s Error, returning a new sink. Read more
source§

fn buffer(self, amt: usize) -> Buffer<Self>
where Self: Sized,

Adds a fixed-size buffer to the current sink. Read more
source§

fn flush(self) -> Flush<Self>
where Self: Sized,

A future that completes when the sink has finished processing all pending requests. Read more
source§

fn send(self, item: Self::SinkItem) -> Send<Self>
where Self: Sized,

A future that completes after the given item has been fully processed into the sink, including flushing. Read more
source§

fn send_all<S>(self, stream: S) -> SendAll<Self, S>
where S: Stream<Item = Self::SinkItem>, Self::SinkError: From<<S as Stream>::Error>, Self: Sized,

A future that completes after the given stream has been fully processed into the sink, including flushing. Read more

Auto Trait Implementations§

§

impl<T, Item> Freeze for CompatSink<T, Item>
where T: Freeze,

§

impl<T, Item> RefUnwindSafe for CompatSink<T, Item>
where T: RefUnwindSafe,

§

impl<T, Item> Send for CompatSink<T, Item>
where T: Send,

§

impl<T, Item> Sync for CompatSink<T, Item>
where T: Sync,

§

impl<T, Item> Unpin for CompatSink<T, Item>
where T: Unpin,

§

impl<T, Item> UnwindSafe for CompatSink<T, Item>
where T: UnwindSafe,

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<Si> Sink01CompatExt for Si
where Si: Sink,

source§

fn sink_compat(self) -> Compat01As03Sink<Self, Self::SinkItem>
where Self: Sized,

Available on crate features compat and sink only.
Converts a futures 0.1 Sink<SinkItem = T, SinkError = E> into a futures 0.3 Sink<T, Error = E>. Read more
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.