Skip to main content

TransportSink

Trait TransportSink 

Source
pub trait TransportSink: Send {
    // Required methods
    fn send<'a>(
        &'a mut self,
        frame: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'a>>;
    fn ping<'a>(
        &'a mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'a>>;
    fn pong<'a>(
        &'a mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'a>>;
    fn close<'a>(
        &'a mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'a>>;
}
Expand description

The write half of a transport: sends one complete OCPP-J text frame at a time.

Implementations own only framing (e.g. WebSocket masking) - Client never sees anything but whole frames and keepalive events.

Methods return a boxed future (the shape #[async_trait] expands to, written by hand) rather than using async fn in the trait, so Box<dyn TransportSink> stays usable - this crate has no dependency on the async-trait crate itself, only on alloc.

Required Methods§

Source

fn send<'a>( &'a mut self, frame: String, ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'a>>

Source

fn ping<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'a>>

Source

fn pong<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'a>>

Source

fn close<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'a>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§