Struct canadensis::node::CoreNode
source · [−]pub struct CoreNode<C, T, U, TR, D, const P: usize, const R: usize> where
C: Clock,
U: Receiver<C::Instant>,
T: Transmitter<C::Instant>, { /* private fields */ }
Expand description
Basic UAVCAN node functionality
Type parameters:
C
: The clock used to get the current timeT
: The transmitter used to send transfersU
: The receiver used to receive transfersTR
: The transfer ID tracker used to manage transfer IDs for outgoing transfersD
: The driver used to send and receive framesP
: The maximum number of topics that can be published This must be greater than 0, or the code will fail to compile. It also must be a power of two, or the software may behave incorrectly.R
: The maximum number of services for which requests can be sent This must be greater than 0, or the code will fail to compile. It also must be a power of two, or the software may behave incorrectly.
Implementations
sourceimpl<C, T, U, N, TR, D, const P: usize, const R: usize> CoreNode<C, T, U, TR, D, P, R> where
C: Clock,
N: Transport,
U: Receiver<C::Instant, Transport = N, Driver = D>,
T: Transmitter<C::Instant, Transport = N, Driver = D>,
TR: TransferIdTracker<N>,
impl<C, T, U, N, TR, D, const P: usize, const R: usize> CoreNode<C, T, U, TR, D, P, R> where
C: Clock,
N: Transport,
U: Receiver<C::Instant, Transport = N, Driver = D>,
T: Transmitter<C::Instant, Transport = N, Driver = D>,
TR: TransferIdTracker<N>,
sourcepub fn new(
clock: C,
node_id: <T::Transport as Transport>::NodeId,
transmitter: T,
receiver: U,
driver: D
) -> Self
pub fn new(
clock: C,
node_id: <T::Transport as Transport>::NodeId,
transmitter: T,
receiver: U,
driver: D
) -> Self
Creates a node
clock
: A clock to use for frame deadlines and timeoutsnode_id
: The ID of this nodetransmitter
: A transport transmitterreceiver
: A transport receiverdriver
: A driver compatible withreceiver
andtransmitter
sourcepub fn driver_mut(&mut self) -> &mut D
pub fn driver_mut(&mut self) -> &mut D
Returns a mutable reference to the enclosed driver
Trait Implementations
sourceimpl<C: Debug, T: Debug, U: Debug, TR: Debug, D: Debug, const P: usize, const R: usize> Debug for CoreNode<C, T, U, TR, D, P, R> where
C: Clock,
U: Receiver<C::Instant>,
T: Transmitter<C::Instant>,
T::Transport: Debug,
C::Instant: Debug,
C::Instant: Debug,
impl<C: Debug, T: Debug, U: Debug, TR: Debug, D: Debug, const P: usize, const R: usize> Debug for CoreNode<C, T, U, TR, D, P, R> where
C: Clock,
U: Receiver<C::Instant>,
T: Transmitter<C::Instant>,
T::Transport: Debug,
C::Instant: Debug,
C::Instant: Debug,
sourceimpl<C, T, U, N, TR, D, const P: usize, const R: usize> Node for CoreNode<C, T, U, TR, D, P, R> where
C: Clock,
N: Transport,
T: Transmitter<<C as Clock>::Instant, Transport = N, Driver = D>,
U: Receiver<<C as Clock>::Instant, Transport = N, Driver = D>,
TR: TransferIdTracker<N>,
impl<C, T, U, N, TR, D, const P: usize, const R: usize> Node for CoreNode<C, T, U, TR, D, P, R> where
C: Clock,
N: Transport,
T: Transmitter<<C as Clock>::Instant, Transport = N, Driver = D>,
U: Receiver<<C as Clock>::Instant, Transport = N, Driver = D>,
TR: TransferIdTracker<N>,
sourcefn start_sending_requests<M>(
&mut self,
service: ServiceId,
receive_timeout: <C::Instant as Instant>::Duration,
response_payload_size_max: usize,
priority: N::Priority
) -> Result<ServiceToken<M>, StartSendError<U::Error>> where
M: Request,
fn start_sending_requests<M>(
&mut self,
service: ServiceId,
receive_timeout: <C::Instant as Instant>::Duration,
response_payload_size_max: usize,
priority: N::Priority
) -> Result<ServiceToken<M>, StartSendError<U::Error>> where
M: Request,
Sets up to send requests for a service
This also subscribes to the corresponding responses.
sourcefn node_id(&self) -> <Self::Transport as Transport>::NodeId
fn node_id(&self) -> <Self::Transport as Transport>::NodeId
Returns the identifier of this node
type Clock = C
type Clock = C
The clock that this node uses
type Transport = N
type Transport = N
The transport that this node uses
type Transmitter = T
type Transmitter = T
The transmitter that this node uses
type Receiver = U
type Receiver = U
The receiver that this node uses
sourcefn receive<H>(&mut self, handler: &mut H) -> Result<(), U::Error> where
H: TransferHandler<Self::Instant, Self::Transport>,
fn receive<H>(&mut self, handler: &mut H) -> Result<(), U::Error> where
H: TransferHandler<Self::Instant, Self::Transport>,
Receives any available incoming frames and attempts ot reassemble them into a transfer Read more
sourcefn start_publishing<M>(
&mut self,
subject: SubjectId,
timeout: <C::Instant as Instant>::Duration,
priority: N::Priority
) -> Result<PublishToken<M>, StartSendError<T::Error>> where
M: Message,
fn start_publishing<M>(
&mut self,
subject: SubjectId,
timeout: <C::Instant as Instant>::Duration,
priority: N::Priority
) -> Result<PublishToken<M>, StartSendError<T::Error>> where
M: Message,
Starts publishing messages on subject Read more
sourcefn stop_publishing<M>(&mut self, token: PublishToken<M>) where
M: Message,
fn stop_publishing<M>(&mut self, token: PublishToken<M>) where
M: Message,
Stops publishing messages on a subject
sourcefn publish<M>(
&mut self,
token: &PublishToken<M>,
payload: &M
) -> Result<(), T::Error> where
M: Message + Serialize,
fn publish<M>(
&mut self,
token: &PublishToken<M>,
payload: &M
) -> Result<(), T::Error> where
M: Message + Serialize,
Publishes a message Read more
sourcefn stop_sending_requests<M>(&mut self, token: ServiceToken<M>) where
M: Request,
fn stop_sending_requests<M>(&mut self, token: ServiceToken<M>) where
M: Request,
Stops sending requests for a service
sourcefn send_request<M>(
&mut self,
token: &ServiceToken<M>,
payload: &M,
destination: N::NodeId
) -> Result<N::TransferId, T::Error> where
M: Request + Serialize,
fn send_request<M>(
&mut self,
token: &ServiceToken<M>,
payload: &M,
destination: N::NodeId
) -> Result<N::TransferId, T::Error> where
M: Request + Serialize,
Sends a service request to another node Read more
sourcefn subscribe_message(
&mut self,
subject: SubjectId,
payload_size_max: usize,
timeout: <C::Instant as Instant>::Duration
) -> Result<(), U::Error>
fn subscribe_message(
&mut self,
subject: SubjectId,
payload_size_max: usize,
timeout: <C::Instant as Instant>::Duration
) -> Result<(), U::Error>
Subscribes to messages on a topic
sourcefn subscribe_request(
&mut self,
service: ServiceId,
payload_size_max: usize,
timeout: <C::Instant as Instant>::Duration
) -> Result<(), U::Error>
fn subscribe_request(
&mut self,
service: ServiceId,
payload_size_max: usize,
timeout: <C::Instant as Instant>::Duration
) -> Result<(), U::Error>
Subscribes to requests for a service
sourcefn send_response<M>(
&mut self,
token: ResponseToken<Self::Transport>,
timeout: <C::Instant as Instant>::Duration,
payload: &M
) -> Result<(), T::Error> where
M: Response + Serialize,
fn send_response<M>(
&mut self,
token: ResponseToken<Self::Transport>,
timeout: <C::Instant as Instant>::Duration,
payload: &M
) -> Result<(), T::Error> where
M: Response + Serialize,
Responds to a service request Read more
sourcefn transmitter(&self) -> &Self::Transmitter
fn transmitter(&self) -> &Self::Transmitter
Returns a reference to the transport transmitter
sourcefn transmitter_mut(&mut self) -> &mut Self::Transmitter
fn transmitter_mut(&mut self) -> &mut Self::Transmitter
Returns a mutable reference to the transport transmitter
sourcefn receiver_mut(&mut self) -> &mut Self::Receiver
fn receiver_mut(&mut self) -> &mut Self::Receiver
Returns a mutable reference to the transport receiver
Auto Trait Implementations
impl<C, T, U, TR, D, const P: usize, const R: usize> RefUnwindSafe for CoreNode<C, T, U, TR, D, P, R> where
C: RefUnwindSafe,
D: RefUnwindSafe,
T: RefUnwindSafe,
TR: RefUnwindSafe,
U: RefUnwindSafe,
<<C as Clock>::Instant as Instant>::Duration: RefUnwindSafe,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::NodeId: RefUnwindSafe,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::Priority: RefUnwindSafe,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::TransferId: RefUnwindSafe,
impl<C, T, U, TR, D, const P: usize, const R: usize> Send for CoreNode<C, T, U, TR, D, P, R> where
C: Send,
D: Send,
T: Send,
TR: Send,
U: Send,
<<C as Clock>::Instant as Instant>::Duration: Send,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::NodeId: Send,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::Priority: Send,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::TransferId: Send,
impl<C, T, U, TR, D, const P: usize, const R: usize> Sync for CoreNode<C, T, U, TR, D, P, R> where
C: Sync,
D: Sync,
T: Sync,
TR: Sync,
U: Sync,
<<C as Clock>::Instant as Instant>::Duration: Sync,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::NodeId: Sync,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::Priority: Sync,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::TransferId: Sync,
impl<C, T, U, TR, D, const P: usize, const R: usize> Unpin for CoreNode<C, T, U, TR, D, P, R> where
C: Unpin,
D: Unpin,
T: Unpin,
TR: Unpin,
U: Unpin,
<<C as Clock>::Instant as Instant>::Duration: Unpin,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::NodeId: Unpin,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::Priority: Unpin,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::TransferId: Unpin,
impl<C, T, U, TR, D, const P: usize, const R: usize> UnwindSafe for CoreNode<C, T, U, TR, D, P, R> where
C: UnwindSafe,
D: UnwindSafe,
T: UnwindSafe,
TR: UnwindSafe,
U: UnwindSafe,
<<C as Clock>::Instant as Instant>::Duration: UnwindSafe,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::NodeId: UnwindSafe,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::Priority: UnwindSafe,
<<T as Transmitter<<C as Clock>::Instant>>::Transport as Transport>::TransferId: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more