Struct fidl::server::ServeInner
source · pub struct ServeInner<D: ResourceDialect = DefaultFuchsiaResourceDialect> { /* private fields */ }
Expand description
A type used from the innards of server implementations.
Implementations§
source§impl<D: ResourceDialect> ServeInner<D>
impl<D: ResourceDialect> ServeInner<D>
sourcepub fn new(channel: D::ProxyChannel) -> Self
pub fn new(channel: D::ProxyChannel) -> Self
Creates a new set of server innards.
sourcepub fn channel(&self) -> &<D::ProxyChannel as ProxyChannelFor<D>>::Boxed
pub fn channel(&self) -> &<D::ProxyChannel as ProxyChannelFor<D>>::Boxed
Gets a reference to the inner channel.
sourcepub fn into_channel(self) -> D::ProxyChannel
pub fn into_channel(self) -> D::ProxyChannel
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, D>,
tx_id: u32,
ordinal: u64,
dynamic_flags: DynamicFlags,
) -> Result<(), Error>
pub fn send<T: TypeMarker>( &self, body: impl Encode<T, D>, 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<<D::Handle as HandleFor<D>>::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<<D::Handle as HandleFor<D>>::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.