prettytty::opt

Struct OptionBuilder

Source
pub struct OptionBuilder(/* private fields */);
Expand description

A builder of options objects.

Implementations§

Source§

impl OptionBuilder

Source

pub fn volume(&mut self, volume: Volume) -> &mut Self

Set the volume.

Source

pub fn mode(&mut self, mode: Mode) -> &mut Self

Set rare or raw mode.

Source

pub fn timeout(&mut self, timeout: u8) -> &mut Self

Set the timeout in deciseconds (0.1s).

Source

pub fn pathological_size(&mut self, size: usize) -> &mut Self

Set the minimum length for pathological ANSI escape sequences.

This method ensures that the given size is at least double the read buffer size, updating it if necessary.

Source

pub fn read_buffer_size(&mut self, size: usize) -> &mut Self

Set the read buffer size.

This method also updates the pathological size to twice the given size.

The read buffer must be large enough to hold the entire escape sequence being recognized. When querying colors, that is 27 bytes: A response for the 16th ANSI color bright white starts with ‹OSC›4;15;rgb: followed by three four-digit hexadecimal numbers separated by forward slashes, such as ffff/ffff/ffff, and then the terminating ‹ST›. Both OSC and ST require at most two bytes, resulting in a maximum sequence length of 27 bytes.

This method ensures that the pathological size is at least double the given size, updating it if necessary.

Source

pub fn write_buffer_size(&mut self, size: usize) -> &mut Self

Set the write buffer size.

Source

pub fn build(&self) -> Options

Instantiate the options.

Trait Implementations§

Source§

impl Debug for OptionBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.