Skip to main content

ControlSequence

Struct ControlSequence 

Source
pub struct ControlSequence<'a> { /* private fields */ }
Expand description

A control sequence as ECMA-48 5th edition section 5.4 defines it: parameter bytes, intermediate bytes, and a final byte identifying the control function.

The introducer is not part of this view. Section 5.4 counts it as part of the sequence, but leaving it out is what lets one type serve every place the shape appears: a CSI body, the command section a DCS carries before its payload, and the setting a DECRPSS reply spells out with no introducer at all.

? 2 0 4 8  h          $ r          2  SP q
┬ ───┬──── ┬          ┬ ┬          ┬  ─┬ ┬
│  params  final      │ final      │   │ final
private               intermediate │   intermediate
                                 params

Implementations§

Source§

impl<'a> ControlSequence<'a>

Source

pub fn parse(body: &'a [u8]) -> Option<(Self, &'a [u8])>

Parse a leading control sequence and return it with the bytes that follow its final byte.

The tail is empty for a CSI body, which ends at the final byte, and carries the payload for a DCS. A caller that expects nothing to follow checks that for itself.

§Returns

None when body holds no final byte, when a byte falls outside the region it appears in, or when more than one intermediate is present. Every control function in use carries at most one, so a second means this is not a sequence worth recognizing.

Source

pub fn private(&self) -> Option<u8>

The first parameter byte when it falls in the private-use range 03/12 to 03/15 (<, =, >, ?), which may only appear there.

Source

pub fn params(&self) -> Params<'a>

The parameter bytes, as a lazy walker over the ;-separated list.

Source

pub fn intermediate(&self) -> Option<u8>

The intermediate byte, from the range 02/00 to 02/15.

Source

pub fn final_byte(&self) -> u8

The final byte, from the range 04/00 to 07/14. It identifies the control function.

Trait Implementations§

Source§

impl<'a> Clone for ControlSequence<'a>

Source§

fn clone(&self) -> ControlSequence<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for ControlSequence<'a>

Source§

impl<'a> Debug for ControlSequence<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ControlSequence<'a>

§

impl<'a> RefUnwindSafe for ControlSequence<'a>

§

impl<'a> Send for ControlSequence<'a>

§

impl<'a> Sync for ControlSequence<'a>

§

impl<'a> Unpin for ControlSequence<'a>

§

impl<'a> UnsafeUnpin for ControlSequence<'a>

§

impl<'a> UnwindSafe for ControlSequence<'a>

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
§

impl<T> ErasedDestructor for T
where T: 'static,

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