pub struct HandlerHandle { /* private fields */ }Expand description
The Handler port role.
A handler that has served nothing is presented every call waiting in the
store; once it has served anything, it is presented only the members it
served, and another handler’s calls stay waiting for that handler. A claim
belongs to the handler it was presented to, so another handler’s settle
of it answers SettleError::UnknownClaim.
The empty set meaning no filter is a deliberate deviation from
Handler::serve, which says delivery starts at the members listed. The
generated dispatch never calls serve
(crates/ridl-backend-rust/src/face/dispatch.rs), so a handler that always filtered
would be presented nothing at all by it. serve with an empty slice
records nothing and so leaves the handler unfiltered, the same as never
having called it. served reads the set back.
The served set is kept twice: here, for served to return a slice, and in
the store, where next_claim filters by it and a caller’s send reads it to
know which handler to wake. serve is the one method that changes it, and
it changes both.
Implementations§
Source§impl HandlerHandle
impl HandlerHandle
Sourcepub fn served(&self) -> &[(InterfaceNo, Ordinal)]
pub fn served(&self) -> &[(InterfaceNo, Ordinal)]
The members serve was called with, in the order they were served,
with no duplicate.
Trait Implementations§
Source§impl Attached for HandlerHandle
impl Attached for HandlerHandle
Source§fn catalog(&self) -> &CatalogRef
fn catalog(&self) -> &CatalogRef
Source§impl Drop for HandlerHandle
A claim this handler has taken and not settled returns to the waiting
calls, and every handler that serves its member is woken. A claim it was
only offered, through ReadError::ShortClaim, never left the waiting calls,
so it is neither re-inserted nor woken for (driftsys/ridl#569). A claim whose
call the caller forgot is withdrawn instead: its slot is reclaimed, and no
handler is presented it again or woken for it. The handler’s waker is
dropped after the lock is released, as the source’s is.
impl Drop for HandlerHandle
A claim this handler has taken and not settled returns to the waiting
calls, and every handler that serves its member is woken. A claim it was
only offered, through ReadError::ShortClaim, never left the waiting calls,
so it is neither re-inserted nor woken for (driftsys/ridl#569). A claim whose
call the caller forgot is withdrawn instead: its slot is reclaimed, and no
handler is presented it again or woken for it. The handler’s waker is
dropped after the lock is released, as the source’s is.
Source§impl Handler for HandlerHandle
impl Handler for HandlerHandle
Source§fn serve(
&mut self,
iface: InterfaceNo,
ords: &[Ordinal],
) -> Result<(), ServeError>
fn serve( &mut self, iface: InterfaceNo, ords: &[Ordinal], ) -> Result<(), ServeError>
Source§fn next_claim(&mut self, out: &mut [u8]) -> Result<Option<Claim>, ReadError>
fn next_claim(&mut self, out: &mut [u8]) -> Result<Option<Claim>, ReadError>
out. Ok(None)
when no call is waiting. When out is shorter than the next call’s
arguments, returns ReadError::ShortClaim with that call’s
ClaimId and the bytes it needs, and does not consume the call: a
later next_claim with a buffer of at least needed bytes presents
the same call under the same id. The id is assigned when the call is
first presented, whether through ShortClaim or through Ok(Some),
and is unique in its channel. next_claim never returns
ReadError::Short.Source§fn settle(
&mut self,
claim: ClaimId,
outcome: Result<&[u8], CallError>,
) -> Result<(), SettleError>
fn settle( &mut self, claim: ClaimId, outcome: Result<&[u8], CallError>, ) -> Result<(), SettleError>
CallError::Contract when the arguments break their typl
constraints, a require clause fails, or an ensure clause fails,
and CallError::Transport(Transport::Corrupt) when the argument
bytes fail the structure check. Read moreSource§impl Wakeable for HandlerHandle
Stores one Claim waker, whatever interface it was registered under, woken
by a send of a member this handler serves, by a serve that admits a call
already waiting, or by another handler’s drop that returns a claim this
handler serves.
impl Wakeable for HandlerHandle
Stores one Claim waker, whatever interface it was registered under, woken
by a send of a member this handler serves, by a serve that admits a call
already waiting, or by another handler’s drop that returns a claim this
handler serves.