Struct canadensis::register::RegisterHandler
source · pub struct RegisterHandler<B> { /* private fields */ }
Expand description
Handles access requests for registers
Basic steps:
- Create a register block (this may be a tuple of
Register
s or a custom type that implementsRegisterBlock
) - Create a handler using
RegisterHandler::init
. Pass the register block and a node used to receive service requests - When calling
accept
on the node, pass the register handler as a transfer handler (or use some other method to pass incoming service requests to the register handler). This lets the register handler process requests and send responses.
Implementations§
source§impl<B> RegisterHandler<B>where
B: RegisterBlock,
impl<B> RegisterHandler<B>where B: RegisterBlock,
sourcepub fn subscribe_requests<N>(
node: &mut N
) -> Result<(), <N::Receiver as Receiver<N::Clock>>::Error>where
N: Node,
pub fn subscribe_requests<N>( node: &mut N ) -> Result<(), <N::Receiver as Receiver<N::Clock>>::Error>where N: Node,
Subscribes to register list and register access requests
This function returns an error if the provided node does not have enough space to listen for requests.
Trait Implementations§
source§impl<I, B, T> TransferHandler<I, T> for RegisterHandler<B>where
I: Instant,
B: RegisterBlock,
T: Transport,
impl<I, B, T> TransferHandler<I, T> for RegisterHandler<B>where I: Instant, B: RegisterBlock, T: Transport,
source§fn handle_request<N: Node<Instant = I, Transport = T>>(
&mut self,
node: &mut N,
token: ResponseToken<T>,
transfer: &ServiceTransfer<Vec<u8>, I, T>
) -> bool
fn handle_request<N: Node<Instant = I, Transport = T>>( &mut self, node: &mut N, token: ResponseToken<T>, transfer: &ServiceTransfer<Vec<u8>, I, T> ) -> bool
Potentially handles an incoming service request Read more
source§fn handle_message<N: Node<Instant = I, Transport = T>>(
&mut self,
_node: &mut N,
_transfer: &MessageTransfer<Vec<u8>, I, T>
) -> bool
fn handle_message<N: Node<Instant = I, Transport = T>>( &mut self, _node: &mut N, _transfer: &MessageTransfer<Vec<u8>, I, T> ) -> bool
Potentially handles an incoming message transfer Read more
source§fn handle_response<N: Node<Instant = I, Transport = T>>(
&mut self,
_node: &mut N,
_transfer: &ServiceTransfer<Vec<u8>, I, T>
) -> bool
fn handle_response<N: Node<Instant = I, Transport = T>>( &mut self, _node: &mut N, _transfer: &ServiceTransfer<Vec<u8>, I, T> ) -> bool
Potentially handles an incoming service response Read more
source§fn handle_loopback<N: Node<Instant = I, Transport = T>>(
&mut self,
_node: &mut N,
_transfer: &Transfer<Vec<u8>, I, T>
) -> bool
fn handle_loopback<N: Node<Instant = I, Transport = T>>( &mut self, _node: &mut N, _transfer: &Transfer<Vec<u8>, I, T> ) -> bool
Potentially handles a loopback transfer sent from this node Read more
source§fn chain<H>(self, next: H) -> TransferHandlerChain<Self, H>where
Self: Sized,
H: TransferHandler<I, T>,
fn chain<H>(self, next: H) -> TransferHandlerChain<Self, H>where Self: Sized, H: TransferHandler<I, T>,
Chains another handler after this handler and returns the combined handler Read more
Auto Trait Implementations§
impl<B> RefUnwindSafe for RegisterHandler<B>where B: RefUnwindSafe,
impl<B> Send for RegisterHandler<B>where B: Send,
impl<B> Sync for RegisterHandler<B>where B: Sync,
impl<B> Unpin for RegisterHandler<B>where B: Unpin,
impl<B> UnwindSafe for RegisterHandler<B>where B: UnwindSafe,
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