Enum hostlink::protocol::EasyCommand  
source · #[non_exhaustive]pub enum EasyCommand {
    Test(Box<str>),
    StatusRead,
}Expand description
A simplified representation of a command.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Test(Box<str>)
Transmits a block of data, which is then repeated by the PLC.
StatusRead
Reads the operating status of the PLC.
Implementations§
source§impl EasyCommand
 
impl EasyCommand
sourcepub fn make_test<S: AsRef<str>>(data: S) -> Result<Self, ProtocolError>
 
pub fn make_test<S: AsRef<str>>(data: S) -> Result<Self, ProtocolError>
Construct a Test command with the given data.
§Example
use hostlink::protocol::{EasyCommand, Message, MessageKind, MessageParams, NodeId};
// Make up a zero node ID (required by the complex API)
let node = NodeId::new(0).unwrap();
// Make up a test message
let test_message = "hello, world!";
// Create a test command using the easy API:
let easy_test = EasyCommand::make_test(test_message).unwrap();
// Same, using the more complex API:
let params = MessageParams::from(test_message);
let complex_test = Message::new(node, MessageKind::Test, params);
// They're the same
assert_eq!(&easy_test, &complex_test);sourcepub const fn make_status_read() -> Self
 
pub const fn make_status_read() -> Self
Construct a StatusRead command.
§Example
use hostlink::protocol::{EasyCommand, Message, MessageKind, MessageParams, NodeId};
// Make up a zero node ID (required by the complex API)
let node = NodeId::new(0).unwrap();
// Create a status read command using the easy API:
let easy_status = EasyCommand::make_status_read();
// Same, using the more complex API:
let complex_status = Message::new_with_empty_params(node, MessageKind::StatusRead);
// They're the same
assert_eq!(&easy_status, &complex_status);sourcepub fn into_message(self, node: NodeId) -> Message
 
pub fn into_message(self, node: NodeId) -> Message
Perform conversion into Message.
sourcepub const fn kind(&self) -> MessageKind
 
pub const fn kind(&self) -> MessageKind
Get the command’s message type.
Trait Implementations§
source§impl Clone for EasyCommand
 
impl Clone for EasyCommand
source§fn clone(&self) -> EasyCommand
 
fn clone(&self) -> EasyCommand
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moresource§impl Debug for EasyCommand
 
impl Debug for EasyCommand
source§impl Display for EasyCommand
 
impl Display for EasyCommand
source§impl Hash for EasyCommand
 
impl Hash for EasyCommand
source§impl Ord for EasyCommand
 
impl Ord for EasyCommand
source§fn cmp(&self, other: &EasyCommand) -> Ordering
 
fn cmp(&self, other: &EasyCommand) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere
    Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<Message> for EasyCommand
 
impl PartialEq<Message> for EasyCommand
source§impl PartialEq for EasyCommand
 
impl PartialEq for EasyCommand
source§fn eq(&self, other: &EasyCommand) -> bool
 
fn eq(&self, other: &EasyCommand) -> bool
This method tests for 
self and other values to be equal, and is used
by ==.source§impl PartialOrd for EasyCommand
 
impl PartialOrd for EasyCommand
source§fn partial_cmp(&self, other: &EasyCommand) -> Option<Ordering>
 
fn partial_cmp(&self, other: &EasyCommand) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
 
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for 
self and other) and is used by the <=
operator. Read moreimpl Eq for EasyCommand
impl StructuralPartialEq for EasyCommand
Auto Trait Implementations§
impl Freeze for EasyCommand
impl RefUnwindSafe for EasyCommand
impl Send for EasyCommand
impl Sync for EasyCommand
impl Unpin for EasyCommand
impl UnwindSafe for EasyCommand
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