Struct Broadcaster

Source
pub struct Broadcaster<T> { /* private fields */ }
Expand description

Broadcast UART recevied data to multiple users.

Normally, if there are multiple users of UART, they share the same buffer (most commonly the kernel buffer). This means that only one user can read a specific piece of data at a time. Broadcaster ensures that all clone of it can receive all data.

Implementations§

Source§

impl<T> Broadcaster<T>

Source

pub fn new(inner: T) -> Broadcaster<T>

Trait Implementations§

Source§

impl<T> Clone for Broadcaster<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: ConsoleDevice> ConsoleDevice for Broadcaster<T>

Source§

fn poll_read(&self, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll<Result<usize>>

Reads received data into buf, returning the number of bytes read. Read more
Source§

fn write(&self, buf: &[u8]) -> Result<()>

Writes data from buf to the UART.
Source§

impl<T> Drop for Broadcaster<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Uart> Uart for Broadcaster<T>

Source§

fn get_baudrate(&self) -> Result<u32>

Returns the UART baudrate. May return zero for virtual UARTs.
Source§

fn set_baudrate(&self, baudrate: u32) -> Result<()>

Sets the UART baudrate. May do nothing for virtual UARTs.
Source§

fn get_flow_control(&self) -> Result<FlowControl>

Source§

fn set_flow_control(&self, flow_control: bool) -> Result<()>

Enables software flow control for writes.
Source§

fn get_device_path(&self) -> Result<String>

Returns "/dev/ttyUSBn" or similar OS device path usable by external programs for directly accessing the serial port.
Source§

fn clear_rx_buffer(&self) -> Result<()>

Clears the UART RX buffer.
Source§

fn set_parity(&self, parity: Parity) -> Result<()>

Source§

fn get_parity(&self) -> Result<Parity>

Source§

fn set_break(&self, enable: bool) -> Result<()>

Auto Trait Implementations§

§

impl<T> Freeze for Broadcaster<T>

§

impl<T> RefUnwindSafe for Broadcaster<T>

§

impl<T> Send for Broadcaster<T>
where T: Send,

§

impl<T> Sync for Broadcaster<T>
where T: Send,

§

impl<T> Unpin for Broadcaster<T>

§

impl<T> UnwindSafe for Broadcaster<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ConsoleExt for T
where T: ConsoleDevice + ?Sized,

Source§

fn read(&self, buf: &mut [u8]) -> Result<usize, Error>

Reads UART receive data into buf, returning the number of bytes read. This function is blocking.
Source§

fn read_timeout( &self, buf: &mut [u8], timeout: Duration, ) -> Result<usize, Error>

Reads UART receive data into buf, returning the number of bytes read. The timeout may be used to specify a duration to wait for data. If timeout expires without any data arriving Ok(0) will be returned, never Err(_).
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V