pub struct SerialDevice {
pub config: SerialDeviceConfig,
pub on_event: SharedEventHandler,
/* private fields */
}Expand description
Generic serial device.
clone() is cheap – all runtime state is behind an Arc.
Fields§
§config: SerialDeviceConfig§on_event: SharedEventHandlerImplementations§
Source§impl SerialDevice
impl SerialDevice
pub fn new(config: SerialDeviceConfig) -> Self
pub fn from_map(data: ParamMap) -> Self
pub fn with_event_handler(self, handler: SharedEventHandler) -> Self
pub fn set_event_handler(&mut self, handler: SharedEventHandler)
pub fn is_connected(&self) -> bool
pub fn to_map(&self) -> ParamMap
pub fn connect_instruction(&self) -> String
pub async fn connect(&self)
pub async fn close(&self)
pub async fn write(&self, data: &str) -> Result<(), String>
pub fn on_receive(&self, data: &str)
Trait Implementations§
Source§impl Clone for SerialDevice
impl Clone for SerialDevice
Auto Trait Implementations§
impl Freeze for SerialDevice
impl !RefUnwindSafe for SerialDevice
impl Send for SerialDevice
impl Sync for SerialDevice
impl Unpin for SerialDevice
impl UnsafeUnpin for SerialDevice
impl !UnwindSafe for SerialDevice
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