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>
impl<C: StreamCapability> ProviderStreamChannel<C>
Sourcepub async fn send(&mut self, message: C::Message) -> Result<(), RuntimeFailure>
pub async fn send(&mut self, message: C::Message) -> Result<(), RuntimeFailure>
Sends one typed message with bounded backpressure.
Sourcepub async fn close_send(&mut self) -> Result<(), RuntimeFailure>
pub async fn close_send(&mut self) -> Result<(), RuntimeFailure>
Closes only the provider’s sending direction.
Sourcepub async fn finish(&mut self) -> Result<(), RuntimeFailure>
pub async fn finish(&mut self) -> Result<(), RuntimeFailure>
Completes the Stream successfully.
Sourcepub async fn fail(
&mut self,
error: C::DomainError,
) -> Result<(), RuntimeFailure>
pub async fn fail( &mut self, error: C::DomainError, ) -> Result<(), RuntimeFailure>
Completes the Stream with a Capability-defined Domain Error.
Sourcepub async fn fail_runtime(
&mut self,
error: RuntimeFailure,
) -> Result<(), RuntimeFailure>
pub async fn fail_runtime( &mut self, error: RuntimeFailure, ) -> Result<(), RuntimeFailure>
Completes the Stream with an infrastructure Runtime Failure.
Sourcepub async fn complete(
self,
result: PluginResult<(), C::DomainError>,
) -> Result<(), RuntimeFailure>
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.
Sourcepub async fn receive(&mut self) -> Result<StreamInput<C>, RuntimeFailure>
pub async fn receive(&mut self) -> Result<StreamInput<C>, RuntimeFailure>
Receives the next typed consumer message or half-close marker.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns whether the consumer cancelled this Stream.