QuicTransport

Struct QuicTransport 

Source
pub struct QuicTransport { /* private fields */ }
Expand description

QUIC-based RPC transport for non-co-located services.

Encodes requests as a simple framed message on a QUIC bidi stream:

[method_id: u32 LE (4B)] [request_id: u64 LE (8B)]
[payload_len: u32 LE (4B)] [payload: [u8; payload_len]]

The response is:

[request_id: u64 LE (8B)] [status: u8 (1B)]
[payload_len: u32 LE (4B)] [payload: [u8; payload_len]]

This is a stub transport that delegates to a user-provided send/receive callback, since the actual QUIC connection setup varies by platform.

Implementations§

Source§

impl QuicTransport

Source

pub fn new( sender: Box<dyn Fn(u32, u64, &[u8]) -> Result<Vec<u8>> + Send + Sync>, ) -> Self

Create a QUIC transport with a send/receive callback.

The callback receives (method_id, request_id, payload) and must return the serialized response bytes or an error.

Trait Implementations§

Source§

impl RpcTransport for QuicTransport

Source§

fn call(&self, method_id: u32, payload: &[u8]) -> Result<Vec<u8>>

Send a request with the given method_id and serialized payload, returning the serialized response bytes.

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.