Struct TerminalChannel

Source
pub struct TerminalChannel { /* private fields */ }
Expand description

An up channel that supports writing into multiple virtual terminals within the same buffer.

An UpChannel can be turned into a TerminalChannel by using the into_terminal method.

Virtual terminals allow you to share one buffer for writing multiple streams. The virtual terminals number from 0 to 15 and are implemented with a simple “terminal switch” sequence on the fly, so there is no need to declare them in advance. You could, for example, use different terminal numbers for messages of different priorities to separate them in a viewer program. Printing uses a TerminalChannel internally.

Implementations§

Source§

impl TerminalChannel

Source

pub fn write(&mut self, number: u8) -> TerminalWriter<'_>

Creates a writer to write a message to the virtual terminal specified by number.

The correct way to use this method is to call it once for each write operation. This is so that non blocking modes will work correctly.

The writer supports formatted writing with the standard Write and ufmt_write::uWrite.

Source

pub fn mode(&self) -> ChannelMode

Gets the current blocking mode of the channel. The default is NoBlockSkip.

Source

pub fn set_mode(&mut self, mode: ChannelMode)

Sets the blocking mode of the channel

Source

pub fn is_empty(&self) -> bool

Returns true if the channel is empty.

Source

pub fn flush(&self)

Wait until all data has been read by the debugger.

Note: This means that if no debugger is connected or if it isn’t reading the rtt data, this function will wait indefinitely.

Auto Trait Implementations§

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> 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, 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.