pub struct RegisterHandler<B> { /* private fields */ }
Expand description

Handles access requests for registers

Basic steps:

  1. Create a register block (this may be a tuple of Registers or a custom type that implements RegisterBlock)
  2. Create a handler using RegisterHandler::init. Pass the register block and a node used to receive service requests
  3. 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,

source

pub fn new(block: B) -> Self

Creates a register handler

source

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.

source

pub fn block(&self) -> &B

Returns a reference to the register block

This can be used to read the current values.

source

pub fn block_mut(&mut self) -> &mut B

Returns a mutable reference to the register block

This can be used to write the register values.

Trait Implementations§

source§

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

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

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

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

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

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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.