Skip to main content

ProviderStreamChannel

Struct ProviderStreamChannel 

Source
pub struct ProviderStreamChannel<C: StreamCapability> { /* private fields */ }
Expand description

The typed provider side of one bounded bidirectional Stream session.

Plugin code uses this channel to exchange Capability values. Generated lowering keeps type erasure and NativeStreamSession behind the facade.

Implementations§

Source§

impl<C: StreamCapability> ProviderStreamChannel<C>

Source

pub async fn send(&mut self, message: C::Message) -> Result<(), RuntimeFailure>

Sends one typed message with bounded backpressure.

Source

pub async fn close_send(&mut self) -> Result<(), RuntimeFailure>

Closes only the provider’s sending direction.

Source

pub async fn finish(&mut self) -> Result<(), RuntimeFailure>

Completes the Stream successfully.

Source

pub async fn fail( &mut self, error: C::DomainError, ) -> Result<(), RuntimeFailure>

Completes the Stream with a Capability-defined Domain Error.

Source

pub async fn fail_runtime( &mut self, error: RuntimeFailure, ) -> Result<(), RuntimeFailure>

Completes the Stream with an infrastructure Runtime Failure.

Source

pub async fn complete( self, result: PluginResult<(), C::DomainError>, ) -> Result<(), RuntimeFailure>

Closes the provider send direction and completes the Stream exactly once.

Consuming the channel prevents Plugin code from accidentally sending or terminating the session again after its operation result is known.

Source

pub async fn receive(&mut self) -> Result<StreamInput<C>, RuntimeFailure>

Receives the next typed consumer message or half-close marker.

Source

pub fn is_cancelled(&self) -> bool

Returns whether the consumer cancelled this Stream.

Trait Implementations§

Source§

impl<C: StreamCapability> Debug for ProviderStreamChannel<C>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C> !RefUnwindSafe for ProviderStreamChannel<C>

§

impl<C> !Send for ProviderStreamChannel<C>

§

impl<C> !Sync for ProviderStreamChannel<C>

§

impl<C> !UnwindSafe for ProviderStreamChannel<C>

§

impl<C> Freeze for ProviderStreamChannel<C>
where Sender<ProviderOutput<C>>: Freeze, Receiver<StreamInput<C>>: Freeze,

§

impl<C> Unpin for ProviderStreamChannel<C>
where Sender<ProviderOutput<C>>: Unpin, Receiver<StreamInput<C>>: Unpin,

§

impl<C> UnsafeUnpin for ProviderStreamChannel<C>
where Sender<ProviderOutput<C>>: UnsafeUnpin, Receiver<StreamInput<C>>: UnsafeUnpin,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.