Trait IntoCxxAsyncStream

Source
pub trait IntoCxxAsyncStream: Sized {
    type Item;

    // Required method
    fn fallible<Stm>(stream: Stm) -> Self
       where Stm: Stream<Item = CxxAsyncResult<Self::Item>> + Send + 'static;

    // Provided method
    fn infallible<Stm>(stream: Stm) -> Self
       where Stm: Stream<Item = Self::Item> + Send + 'static,
             Stm::Item: 'static { ... }
}
Expand description

Wraps an arbitrary Rust Stream in a boxed cxx-async stream so that it can be returned to C++.

You should not need to implement this manually; it’s automatically implemented by the bridge_stream macro.

Required Associated Types§

Source

type Item

The type of the values yielded by the stream.

Required Methods§

Source

fn fallible<Stm>(stream: Stm) -> Self
where Stm: Stream<Item = CxxAsyncResult<Self::Item>> + Send + 'static,

Wraps a Rust Stream that yields items of the output type, wrapped in CxxAsyncResults.

Use this when you have error values that you want to turn into exceptions on the C++ side.

Provided Methods§

Source

fn infallible<Stm>(stream: Stm) -> Self
where Stm: Stream<Item = Self::Item> + Send + 'static, Stm::Item: 'static,

Wraps a Rust Stream that directly yields items of the output type.

Use this when you aren’t interested in propagating errors to C++ as exceptions.

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.

Implementors§