Sender

Struct Sender 

Source
pub struct Sender<W> { /* private fields */ }
Expand description

A sender that wraps an async writer.

Implementations§

Source§

impl<W: AsyncWriteExt + Unpin + Send> Sender<W>

Source

pub const fn new(writer: W) -> Self

Create a new sender.

Source

pub const fn set_line_ending(&mut self, ending: LineEnding)

Set the line ending.

Source

pub const fn set_char_delay(&mut self, delay: Option<Duration>)

Set character delay for slow typing.

Source

pub const fn line_ending(&self) -> LineEnding

Get the line ending.

Source

pub async fn send_with_delay(&mut self, data: &[u8]) -> Result<()>

Send bytes with optional character delay.

Source

pub const fn writer_mut(&mut self) -> &mut W

Get mutable access to the underlying writer.

Trait Implementations§

Source§

impl<W: AsyncWriteExt + Unpin + Send> BasicSend for Sender<W>

Source§

async fn send_bytes(&mut self, data: &[u8]) -> Result<()>

Send raw bytes.
Source§

async fn send_line(&mut self, line: &str) -> Result<()>

Send a line with LF ending.
Source§

fn send_str(&mut self, s: &str) -> impl Future<Output = Result<()>> + Send

Send a string.
Source§

fn send_line_with( &mut self, line: &str, ending: LineEnding, ) -> impl Future<Output = Result<()>> + Send

Send a line with the specified line ending.
Source§

fn send_control( &mut self, ctrl: ControlChar, ) -> impl Future<Output = Result<()>> + Send

Send a control character.
Source§

fn send_interrupt(&mut self) -> impl Future<Output = Result<()>> + Send

Send Ctrl+C (interrupt).
Source§

fn send_eof(&mut self) -> impl Future<Output = Result<()>> + Send

Send Ctrl+D (EOF).
Source§

fn send_suspend(&mut self) -> impl Future<Output = Result<()>> + Send

Send Ctrl+Z (suspend).
Source§

fn send_escape(&mut self) -> impl Future<Output = Result<()>> + Send

Send Escape.
Source§

fn send_tab(&mut self) -> impl Future<Output = Result<()>> + Send

Send Tab (Ctrl+I).
Source§

fn send_backspace(&mut self) -> impl Future<Output = Result<()>> + Send

Send Backspace (Ctrl+H).

Auto Trait Implementations§

§

impl<W> Freeze for Sender<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for Sender<W>
where W: RefUnwindSafe,

§

impl<W> Send for Sender<W>
where W: Send,

§

impl<W> Sync for Sender<W>
where W: Sync,

§

impl<W> Unpin for Sender<W>
where W: Unpin,

§

impl<W> UnwindSafe for Sender<W>
where W: UnwindSafe,

Blanket Implementations§

Source§

impl<T> AnsiSend for T
where T: BasicSend,

Source§

fn send_cursor_up(&mut self) -> impl Future<Output = Result<()>> + Send
where Self: Send,

Send cursor up.
Source§

fn send_cursor_down(&mut self) -> impl Future<Output = Result<()>> + Send
where Self: Send,

Send cursor down.
Source§

fn send_cursor_right(&mut self) -> impl Future<Output = Result<()>> + Send
where Self: Send,

Send cursor right.
Source§

fn send_cursor_left(&mut self) -> impl Future<Output = Result<()>> + Send
where Self: Send,

Send cursor left.
Source§

fn send_home(&mut self) -> impl Future<Output = Result<()>> + Send
where Self: Send,

Send home key.
Source§

fn send_end(&mut self) -> impl Future<Output = Result<()>> + Send
where Self: Send,

Send end key.
Source§

fn send_delete(&mut self) -> impl Future<Output = Result<()>> + Send
where Self: Send,

Send delete key.
Source§

fn send_function_key( &mut self, n: u8, ) -> impl Future<Output = Result<()>> + Send
where Self: Send,

Send a function key.
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.
Source§

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

Source§

fn vzip(self) -> V