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
impl Registration
Sourcepub fn new(identity: ServiceIdentity) -> Self
pub fn new(identity: ServiceIdentity) -> Self
A registration on the local transport only (TransportProfile::Local).
Sourcepub fn transport(self, transport: TransportProfile) -> Self
pub fn transport(self, transport: TransportProfile) -> Self
Choose the transport profile. Set it before registering methods that name remote scopes.
Sourcepub fn method(
self,
descriptor: MethodDescriptor,
handler: impl Fn(&CallContext, &Value, &Emit) -> Result<Value, ServiceError> + Send + Sync + 'static,
) -> Result<Self, RegistrationError>
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.
Sourcepub fn on_handoff(self, hook: impl Fn() + Send + Sync + 'static) -> Self
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.
Sourcepub fn on_connection_closed(
self,
hook: impl Fn(u64) + Send + Sync + 'static,
) -> Self
pub fn on_connection_closed( self, hook: impl Fn(u64) + Send + Sync + 'static, ) -> Self
Called with the connection id when a connection closes.
pub fn identity(&self) -> &ServiceIdentity
pub fn profile(&self) -> TransportProfile
pub fn methods(&self) -> &MethodTable
Sourcepub fn into_parts(
self,
) -> Result<(ServiceIdentity, TransportProfile, MethodTable, Arc<dyn Handler>), RegistrationError>
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§
impl !RefUnwindSafe for Registration
impl !UnwindSafe for Registration
impl Freeze for Registration
impl Send for Registration
impl Sync for Registration
impl Unpin for Registration
impl UnsafeUnpin for Registration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more