Skip to main content

FromClientError

Trait FromClientError 

Source
pub trait FromClientError {
    // Required method
    fn from_client_error(error: ClientError) -> Self;
}
Expand description

An event type that can carry a client failure in band.

The client’s implementation of an emitted trait yields each data event as is and, on an Err(ClientError), yields E::from_client_error(err) and ends. Implement it on the activation’s event enum, usually as its in-band error variant:

impl plexus_client::FromClientError for EchoEvent {
    fn from_client_error(error: plexus_client::ClientError) -> Self {
        EchoEvent::Error { message: error.to_string() }
    }
}

Required Methods§

Source

fn from_client_error(error: ClientError) -> Self

The event that stands for error. It is the last item of its stream.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FromClientError for String

Source§

impl<T, E: FromClientError> FromClientError for Result<T, E>

A stream of strings carries a client failure as its message — so an activation whose events are plain Strings (a type no crate but this one may implement the trait for) still has its trait implemented by its client. A Result item carries a client failure as its error (RETURNS-36): what the trait’s client half yields for a fallible method.

Implementors§

Source§

impl<T: FromClientError, P> FromClientError for Progress<T, P>

A progress item carries a client failure as its item (RETURNS-36).