Skip to main content

HandlerHandle

Struct HandlerHandle 

Source
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

Source

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

Source§

fn catalog(&self) -> &CatalogRef

The catalog this port serves.
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.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Handler for HandlerHandle

Source§

fn serve( &mut self, iface: InterfaceNo, ords: &[Ordinal], ) -> Result<(), ServeError>

Starts presenting calls to the listed members.
Source§

fn next_claim(&mut self, out: &mut [u8]) -> Result<Option<Claim>, ReadError>

Copies the next call’s arguments into the front of 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>

Settles a claim with the reply bytes (empty for a command) or the outcome the caller sees. A provider settles 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 more
Source§

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.

Source§

fn wake_on(&self, what: Interest, waker: &Waker)

Wakes waker when the thing what names may have changed, under the contract above.

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, 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.