pub struct Notification<'a> { /* private fields */ }Expand description
A borrowed notification returned by a transport implementation.
Implementations§
Source§impl<'a> Notification<'a>
impl<'a> Notification<'a>
Sourcepub const fn new(source: NotificationSource, bytes: &'a [u8]) -> Self
pub const fn new(source: NotificationSource, bytes: &'a [u8]) -> Self
Creates a notification tagged with its originating characteristic.
The returned value borrows bytes; transports normally borrow from the
receive buffer supplied to their notification method.
§Examples
use chessnut_move::transport::{Notification, NotificationSource};
let bytes = [0x23, 0x01, 0x00];
let notification =
Notification::new(NotificationSource::CommandResponse, &bytes);
assert_eq!(notification.bytes(), &bytes);Sourcepub const fn source(&self) -> NotificationSource
pub const fn source(&self) -> NotificationSource
Returns the characteristic category that produced this notification.
Trait Implementations§
Source§impl<'a> Clone for Notification<'a>
impl<'a> Clone for Notification<'a>
Source§fn clone(&self) -> Notification<'a>
fn clone(&self) -> Notification<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for Notification<'a>
Source§impl<'a> Debug for Notification<'a>
impl<'a> Debug for Notification<'a>
impl<'a> Eq for Notification<'a>
Source§impl<'a> PartialEq for Notification<'a>
impl<'a> PartialEq for Notification<'a>
impl<'a> StructuralPartialEq for Notification<'a>
Auto Trait Implementations§
impl<'a> Freeze for Notification<'a>
impl<'a> RefUnwindSafe for Notification<'a>
impl<'a> Send for Notification<'a>
impl<'a> Sync for Notification<'a>
impl<'a> Unpin for Notification<'a>
impl<'a> UnsafeUnpin for Notification<'a>
impl<'a> UnwindSafe for Notification<'a>
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