[][src]Struct serial_frame::SerialFrameSender

pub struct SerialFrameSender { /* fields omitted */ }

The frame sender structure, this will create a SerialFrameSender, that once started will split incoming bytes from the serialport and send them framed by the separator

Ex: "This is one line\nAnd this is another\n"

will return "This is one line\n", and "This is another\n" in two separate vectors over the channel sent in when starting the thread

Methods

impl SerialFrameSender[src]

pub fn new(separator: u8, port: Box<dyn SerialPort>) -> SerialFrameSender[src]

pub fn add_error_channel(&mut self) -> Receiver<SerialFrameError>[src]

pub fn start<T: 'static + Send + TryFrom<Vec<u8>>>(
    self,
    type_send: Sender<T>
) -> Result<SerialFrameStopper>
[src]

Consumes the SerialFrameSender and creates a new running thread, that will send complete frames over the Channel it takes as input separated by the specified separator. It will also try to convert those bytes into a Type that has implemented the TryFrom<Vec>

Returned is structure that can be used to stop this thread, and thus unblock the serialport or an error

pub fn stop(&mut self)[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.