Skip to main content

ServerRpc

Struct ServerRpc 

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

Server-side RPC state machine.

Implementations§

Source§

impl ServerRpc

Source

pub fn from_call_start( ctx: Context, call_start: CallStart, writer: Arc<dyn PacketWriter>, ) -> Self

Creates a new ServerRpc from a CallStart packet.

Source

pub fn context(&self) -> &Context

Returns the context for this RPC.

Source

pub fn service(&self) -> &str

Returns the service ID.

Source

pub fn method(&self) -> &str

Returns the method ID.

Source

pub async fn wait(&self) -> Result<()>

Waits for the RPC to finish.

Source

pub async fn handle_packet(&self, packet: Packet) -> Result<()>

Handles an incoming packet.

Source

pub async fn handle_stream_close(&self, err: Option<String>) -> Result<()>

Handles stream close from the transport.

Source

pub async fn send_error(&self, error: String) -> Result<()>

Sends an error response and closes.

Trait Implementations§

Source§

impl Stream for ServerRpc

Source§

fn context(&self) -> &Context

Returns the context for this stream. Read more
Source§

fn send_bytes<'life0, 'async_trait>( &'life0 self, data: Bytes, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends raw bytes on the stream. Read more
Source§

fn recv_bytes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Receives raw bytes from the stream. Read more
Source§

fn close_send<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes the send side of the stream. Read more
Source§

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes both sides of the stream. Read more

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> StreamExt for T
where T: Stream + ?Sized,

Source§

fn msg_send<'life0, 'life1, 'async_trait, M>( &'life0 self, msg: &'life1 M, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where M: 'async_trait + Message + Send + Sync, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sends a typed message on the stream. Read more
Source§

fn msg_recv<'life0, 'async_trait, M>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<M>> + Send + 'async_trait>>
where M: 'async_trait + Message + Default, Self: Sync + 'async_trait, 'life0: 'async_trait,

Receives a typed message from the stream. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.