pub enum ModeSetting {
NotRecognized,
Set,
Reset,
PermanentlySet,
PermanentlyReset,
}Expand description
Decoded state value from a mode report response (DECRPM or ANSI report).
The numeric values are the Ps status field in ESC [ ? mode ; Ps $ y or
ESC [ mode ; Ps $ y.
Variants§
NotRecognized
Report value 0: the terminal does not recognize the requested mode.
Set
Report value 1: the mode is currently set.
Reset
Report value 2: the mode is currently reset.
PermanentlySet
Report value 3: the mode is permanently set and cannot be reset.
PermanentlyReset
Report value 4: the mode is permanently reset and cannot be set.
Implementations§
Source§impl ModeSetting
impl ModeSetting
Sourcepub fn from_value(v: u16) -> Self
pub fn from_value(v: u16) -> Self
Convert a numeric mode-report status value into ModeSetting.
Values 1..=4 map to their defined states; every other value maps to ModeSetting::NotRecognized.
Sourcepub fn is_set(self) -> bool
pub fn is_set(self) -> bool
Return true for ModeSetting::Set and ModeSetting::PermanentlySet.
Sourcepub fn is_reset(self) -> bool
pub fn is_reset(self) -> bool
Return true for ModeSetting::Reset and ModeSetting::PermanentlyReset.
Sourcepub fn is_recognized(self) -> bool
pub fn is_recognized(self) -> bool
Return whether the terminal recognized the mode.
Only ModeSetting::NotRecognized is considered unrecognized.
Sourcepub fn is_permanent(self) -> bool
pub fn is_permanent(self) -> bool
Return whether the mode is permanently fixed and cannot be toggled.
Both ModeSetting::PermanentlySet and ModeSetting::PermanentlyReset
report a state the host cannot change.
Sourcepub fn is_available(self) -> bool
pub fn is_available(self) -> bool
Return whether the mode can actually be used by the host.
This is true for every recognized state except
ModeSetting::PermanentlyReset: a permanently reset mode is
recognized but the terminal will never allow it to be set, so the
feature it gates is effectively unavailable. Use this (rather than
is_recognized) when deciding whether a
capability can be relied upon.
Trait Implementations§
Source§impl Clone for ModeSetting
impl Clone for ModeSetting
Source§fn clone(&self) -> ModeSetting
fn clone(&self) -> ModeSetting
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModeSetting
impl Debug for ModeSetting
Source§impl Display for ModeSetting
impl Display for ModeSetting
Source§impl Hash for ModeSetting
impl Hash for ModeSetting
Source§impl PartialEq for ModeSetting
impl PartialEq for ModeSetting
Source§fn eq(&self, other: &ModeSetting) -> bool
fn eq(&self, other: &ModeSetting) -> bool
self and other values to be equal, and is used by ==.impl Copy for ModeSetting
impl Eq for ModeSetting
impl StructuralPartialEq for ModeSetting
Auto Trait Implementations§
impl Freeze for ModeSetting
impl RefUnwindSafe for ModeSetting
impl Send for ModeSetting
impl Sync for ModeSetting
impl Unpin for ModeSetting
impl UnsafeUnpin for ModeSetting
impl UnwindSafe for ModeSetting
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString]. Read more