GpsdJsonEncodeAsync

Trait GpsdJsonEncodeAsync 

Source
pub trait GpsdJsonEncodeAsync: AsyncWrite + Unpin {
    // Provided method
    fn write_request(
        &mut self,
        request: &impl GpsdJsonRequest,
    ) -> impl Future<Output = Result<()>> { ... }
}
Expand description

Extension trait for writing GPSD JSON requests to an async writer

This trait provides functionality to asynchronously encode and send GPSD request messages to any type that implements AsyncWriteExt. The messages are formatted as GPSD commands and sent to the stream.

This is the async equivalent of GpsdJsonEncode.

Provided Methods§

Source

fn write_request( &mut self, request: &impl GpsdJsonRequest, ) -> impl Future<Output = Result<()>>

Writes a request message to the async output stream

This method converts the request to a GPSD command string and asynchronously writes it to the underlying stream.

§Arguments
  • request - The request message to send
§Returns

A future that resolves to:

  • Ok(()) - Request successfully written
  • Err(_) - I/O error occurred during write
§Example
writer.write_request(request).await.expect("Failed to send request");

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§