pub trait Server<Target, Codec>: ServerBase{
// Required methods
fn new(target: Target, request_buffer: usize) -> (Self, Self::Client);
fn serve<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Option<Target>> + Send + 'async_trait>>
where Self: 'async_trait;
}
Available on crate feature
rtc
only.Expand description
A server of a remotable trait taking the target object by value.
Required Methods§
sourcefn new(target: Target, request_buffer: usize) -> (Self, Self::Client)
fn new(target: Target, request_buffer: usize) -> (Self, Self::Client)
Creates a new server instance for the target object.
sourcefn serve<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Option<Target>> + Send + 'async_trait>>where
Self: 'async_trait,
fn serve<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Option<Target>> + Send + 'async_trait>>where
Self: 'async_trait,
Serves the target object.
Serving ends when the client is dropped or a method taking self by value is called. In the first case, the target object is returned and, in the second case, None is returned.
Object Safety§
This trait is not object safe.