pub struct SerialApi { /* private fields */ }Expand description
A handle to the link layer task. Cloning is cheap; all clones share one port.
Implementations§
Source§impl SerialApi
impl SerialApi
Sourcepub fn start<T>(io: T, config: Config) -> (SerialApi, Receiver<DataFrame>)
pub fn start<T>(io: T, config: Config) -> (SerialApi, Receiver<DataFrame>)
Starts the link layer on io and returns the handle and the
unsolicited frame channel.
Sourcepub fn next_callback_id(&self) -> u8
pub fn next_callback_id(&self) -> u8
The next callback id, 1 to 255 (0 means “no callback” on the wire).
Sourcepub async fn request(
&self,
frame: DataFrame,
timeout: Duration,
) -> Result<DataFrame, SerialError>
pub async fn request( &self, frame: DataFrame, timeout: Duration, ) -> Result<DataFrame, SerialError>
Sends a request and returns its response frame.
Sourcepub fn close(&self)
pub fn close(&self)
Stops the link task and closes the port, for every clone of this
handle: the exchange in progress fails, the unsolicited channel ends,
and later requests fail with SerialError::Closed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SerialApi
impl RefUnwindSafe for SerialApi
impl Send for SerialApi
impl Sync for SerialApi
impl Unpin for SerialApi
impl UnsafeUnpin for SerialApi
impl UnwindSafe for SerialApi
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