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
paramsImplementations§
Source§impl<'a> ControlSequence<'a>
impl<'a> ControlSequence<'a>
Sourcepub fn parse(body: &'a [u8]) -> Option<(Self, &'a [u8])>
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.
Sourcepub fn private(&self) -> Option<u8>
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.
Sourcepub fn params(&self) -> Params<'a>
pub fn params(&self) -> Params<'a>
The parameter bytes, as a lazy walker over the ;-separated list.
Sourcepub fn intermediate(&self) -> Option<u8>
pub fn intermediate(&self) -> Option<u8>
The intermediate byte, from the range 02/00 to 02/15.
Sourcepub fn final_byte(&self) -> u8
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>
impl<'a> Clone for ControlSequence<'a>
Source§fn clone(&self) -> ControlSequence<'a>
fn clone(&self) -> ControlSequence<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more