Skip to main content

Registration

Struct Registration 

Source
pub struct Registration { /* private fields */ }
Expand description

Identity, method descriptors and one handler closure per method, checked together. See the module docs.

Implementations§

Source§

impl Registration

Source

pub fn new(identity: ServiceIdentity) -> Self

A registration on the local transport only (TransportProfile::Local).

Source

pub fn transport(self, transport: TransportProfile) -> Self

Choose the transport profile. Set it before registering methods that name remote scopes.

Source

pub fn method( self, descriptor: MethodDescriptor, handler: impl Fn(&CallContext, &Value, &Emit) -> Result<Value, ServiceError> + Send + Sync + 'static, ) -> Result<Self, RegistrationError>

Register a method and its handler.

Source

pub fn on_handoff(self, hook: impl Fn() + Send + Sync + 'static) -> Self

Called once when a higher-ranked host asks for the service: stop starting new steps.

Source

pub fn on_connection_closed( self, hook: impl Fn(u64) + Send + Sync + 'static, ) -> Self

Called with the connection id when a connection closes.

Source

pub fn identity(&self) -> &ServiceIdentity

Source

pub fn profile(&self) -> TransportProfile

Source

pub fn methods(&self) -> &MethodTable

Source

pub fn into_parts( self, ) -> Result<(ServiceIdentity, TransportProfile, MethodTable, Arc<dyn Handler>), RegistrationError>

The parts a ServiceBuilder hosts: the identity, the profile, the method table and the one handler that dispatches to the registered closures.

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.