Struct fidl::server::ServeInner
source · pub struct ServeInner { /* private fields */ }
Expand description
A type used from the innards of server implementations.
Implementations§
source§impl ServeInner
impl ServeInner
sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Creates a new set of server innards.
sourcepub fn channel(&self) -> &AsyncChannel
pub fn channel(&self) -> &AsyncChannel
Gets a reference to the inner channel.
sourcepub fn into_channel(self) -> AsyncChannel
pub fn into_channel(self) -> AsyncChannel
Converts the [ServerInner
] back into a channel.
Warning: This operation is dangerous, since the returned channel could have unread messages intended for this server. Use it carefully.
sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Sets the server to shutdown the next time the stream is polled.
TODO(https://fxbug.dev/42153903): This should cause the channel to close on the next poll, but in fact the channel won’t close until the user of the bindings drops their request stream, responders, and control handles.
sourcepub fn shutdown_with_epitaph(&self, status: Status)
pub fn shutdown_with_epitaph(&self, status: Status)
Sets the server to shutdown with an epitaph the next time the stream is polled.
TODO(https://fxbug.dev/42153903): This should cause the channel to close on the next poll, but in fact the channel won’t close until the user of the bindings drops their request stream, responders, and control handles.
sourcepub fn check_shutdown(&self, cx: &Context<'_>) -> bool
pub fn check_shutdown(&self, cx: &Context<'_>) -> bool
Checks if the server has been set to shutdown.
sourcepub fn send<T: TypeMarker>(
&self,
body: impl Encode<T>,
tx_id: u32,
ordinal: u64,
dynamic_flags: DynamicFlags,
) -> Result<(), Error>
pub fn send<T: TypeMarker>( &self, body: impl Encode<T>, tx_id: u32, ordinal: u64, dynamic_flags: DynamicFlags, ) -> Result<(), Error>
Sends an encodable message to the client.
sourcepub fn send_framework_err(
&self,
framework_err: FrameworkErr,
tx_id: u32,
ordinal: u64,
dynamic_flags: DynamicFlags,
tls_decode_buf: (&mut Vec<u8>, &mut Vec<HandleInfo>),
) -> Result<(), Error>
pub fn send_framework_err( &self, framework_err: FrameworkErr, tx_id: u32, ordinal: u64, dynamic_flags: DynamicFlags, tls_decode_buf: (&mut Vec<u8>, &mut Vec<HandleInfo>), ) -> Result<(), Error>
Sends a framework error to the client.
The caller must be inside a with_tls_decode_buf
callback, and pass the
buffers used to decode the request as the tls_decode_buf
parameter.