pub struct TcpDevice {
pub config: TcpDeviceConfig,
pub on_event: SharedEventHandler,
/* private fields */
}Expand description
Generic TCP device.
clone() is cheap – all runtime state is behind an Arc.
Fields§
§config: TcpDeviceConfig§on_event: SharedEventHandlerImplementations§
Source§impl TcpDevice
impl TcpDevice
pub fn new(config: TcpDeviceConfig) -> 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§
Auto Trait Implementations§
impl Freeze for TcpDevice
impl !RefUnwindSafe for TcpDevice
impl Send for TcpDevice
impl Sync for TcpDevice
impl Unpin for TcpDevice
impl UnsafeUnpin for TcpDevice
impl !UnwindSafe for TcpDevice
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