[][src]Struct xterm_js_sys::xterm::BufferCell

#[repr(transparent)]pub struct BufferCell {
    obj: JsValue,
}

Represents a single cell in the terminal’s buffer.

(This is a duck-typed interface).

Fields

obj: JsValue

Implementations

impl BufferCell[src]

pub fn get_bg_color(&self) -> Color[src]

Gets a cell’s background color number, this differs depending on what the color mode of the cell is:

  • Default: This should be 0, representing the default background color (CSI 49 m).
  • Palette: This is a number from 0 to 255 of ANSI colors (CSI 4(0-7) m, CSI 10(0-7) m, CSI 48 ; 5 ; 0-255 m).
  • RGB: A hex value representing a ‘true color’: 0xRRGGBB (CSI 4 8 ; 2 ; Pi ; Pr ; Pg ; Pb)

impl BufferCell[src]

pub fn get_bg_color_mode(&self) -> u8[src]

Gets the number representation of the background color mode, this can be used to perform quick comparisons of 2 cells to see if they’re the same. Use is_bg_rgb, is_bg_palette, and is_bg_default to check what color mode a cell is.

impl BufferCell[src]

pub fn get_chars(&self) -> Str[src]

The character(s) within the cell. Examples of what this can contain:

  • A normal width character
  • A wide character (eg. CJK)
  • An emoji

impl BufferCell[src]

pub fn get_code(&self) -> u32[src]

Gets the UTF32 codepoint of single characters, if content is a combined string it returns the codepoint of the last character in the string.

impl BufferCell[src]

pub fn get_fg_color(&self) -> Color[src]

Gets a cell’s foreground color number, this differs depending on what the color mode of the cell is:

  • Default: This should be 0, representing the default foreground color (CSI 39 m).
  • Palette: This is a number from 0 to 255 of ANSI colors (CSI 3(0-7) m, CSI 9(0-7) m, CSI 38 ; 5 ; 0-255 m).
  • RGB: A hex value representing a ‘true color’: 0xRRGGBB. (CSI 3 8 ; 2 ; Pi ; Pr ; Pg ; Pb)

impl BufferCell[src]

pub fn get_fg_color_mode(&self) -> u8[src]

Gets the number representation of the foreground color mode, this can be used to perform quick comparisons of 2 cells to see if they’re the same. Use is_fg_rgb, is_fg_palette, and is_fg_default to check what color mode a cell is.

impl BufferCell[src]

pub fn get_width(&self) -> u8[src]

The width of the character. Some examples:

  • 1 for most cells.
  • 2 for wide character like CJK glyphs.
  • 0 for cells immediately following cells with a width of 2.

impl BufferCell[src]

pub fn is_attribute_default(&self) -> bool[src]

Whether the cell has the default attribute (no color or style).

impl BufferCell[src]

pub fn is_bg_default(&self) -> bool[src]

Whether the cell is using the default background color mode.

impl BufferCell[src]

pub fn is_bg_palette(&self) -> bool[src]

Whether the cell is using the palette background color mode.

impl BufferCell[src]

pub fn is_bg_rgb(&self) -> bool[src]

Whether the cell is using the RGB background color mode.

impl BufferCell[src]

Whether the cell has the inverse attribute (CSI 5 m).

impl BufferCell[src]

pub fn is_bold(&self) -> bool[src]

Whether the cell has the bold attribute (CSI 1 m).

impl BufferCell[src]

pub fn is_dim(&self) -> bool[src]

Whether the cell has the inverse attribute (CSI 2 m).

impl BufferCell[src]

pub fn is_fg_default(&self) -> bool[src]

Whether the cell is using the default foreground color mode.

impl BufferCell[src]

pub fn is_fg_palette(&self) -> bool[src]

Whether the cell is using the palette foreground color mode.

impl BufferCell[src]

pub fn is_fg_rgb(&self) -> bool[src]

Whether the cell is using the RGB foreground color mode.

impl BufferCell[src]

pub fn is_inverse(&self) -> bool[src]

Whether the cell has the inverse attribute (CSI 7 m).

impl BufferCell[src]

pub fn is_invisible(&self) -> bool[src]

Whether the cell has the inverse attribute (CSI 8 m).

impl BufferCell[src]

pub fn is_italic(&self) -> bool[src]

Whether the cell has the inverse attribute (CSI 3 m).

impl BufferCell[src]

pub fn is_underline(&self) -> bool[src]

Whether the cell has the underline attribute (CSI 4 m).

Methods from Deref<Target = JsValue>

pub const NULL: JsValue[src]

pub const UNDEFINED: JsValue[src]

pub const TRUE: JsValue[src]

pub const FALSE: JsValue[src]

pub fn as_f64(&self) -> Option<f64>[src]

This is supported on feature="ext" only.

Returns the f64 value of this JS value if it's an instance of a number.

If this JS value is not an instance of a number then this returns None.

pub fn is_string(&self) -> bool[src]

This is supported on feature="ext" only.

Tests whether this JS value is a JS string.

pub fn as_string(&self) -> Option<String>[src]

This is supported on feature="ext" only.

If this JS value is a string value, this function copies the JS string value into wasm linear memory, encoded as UTF-8, and returns it as a Rust String.

To avoid the copying and re-encoding, consider the JsString::try_from() function from js-sys instead.

If this JS value is not an instance of a string or if it's not valid utf-8 then this returns None.

UTF-16 vs UTF-8

JavaScript strings in general are encoded as UTF-16, but Rust strings are encoded as UTF-8. This can cause the Rust string to look a bit different than the JS string sometimes. For more details see the documentation about the str type which contains a few caveats about the encodings.

pub fn as_bool(&self) -> Option<bool>[src]

This is supported on feature="ext" only.

Returns the bool value of this JS value if it's an instance of a boolean.

If this JS value is not an instance of a boolean then this returns None.

pub fn is_null(&self) -> bool[src]

This is supported on feature="ext" only.

Tests whether this JS value is null

pub fn is_undefined(&self) -> bool[src]

This is supported on feature="ext" only.

Tests whether this JS value is undefined

pub fn is_symbol(&self) -> bool[src]

This is supported on feature="ext" only.

Tests whether the type of this JS value is symbol

pub fn is_object(&self) -> bool[src]

This is supported on feature="ext" only.

Tests whether typeof self == "object" && self !== null.

pub fn is_function(&self) -> bool[src]

This is supported on feature="ext" only.

Tests whether the type of this JS value is function.

pub fn is_truthy(&self) -> bool[src]

This is supported on feature="ext" only.

Tests whether the value is "truthy".

pub fn is_falsy(&self) -> bool[src]

This is supported on feature="ext" only.

Tests whether the value is "falsy".

Trait Implementations

impl AsRef<BufferCell> for BufferCell[src]

impl AsRef<JsValue> for BufferCell[src]

impl Deref for BufferCell[src]

type Target = JsValue

The resulting type after dereferencing.

impl From<BufferCell> for JsValue[src]

impl From<JsValue> for BufferCell[src]

impl FromWasmAbi for BufferCell[src]

type Abi = <JsValue as FromWasmAbi>::Abi

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

impl IntoWasmAbi for BufferCell[src]

type Abi = <JsValue as IntoWasmAbi>::Abi

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

impl<'a> IntoWasmAbi for &'a BufferCell[src]

type Abi = <&'a JsValue as IntoWasmAbi>::Abi

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

impl JsCast for BufferCell[src]

impl OptionFromWasmAbi for BufferCell[src]

impl OptionIntoWasmAbi for BufferCell[src]

impl<'a> OptionIntoWasmAbi for &'a BufferCell[src]

impl RefFromWasmAbi for BufferCell[src]

type Abi = <JsValue as RefFromWasmAbi>::Abi

The wasm ABI type references to Self are recovered from.

type Anchor = ManuallyDrop<BufferCell>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don't persist beyond one function call, and so that they remain anonymous. Read more

impl WasmDescribe for BufferCell[src]

Auto Trait Implementations

impl RefUnwindSafe for BufferCell

impl !Send for BufferCell

impl !Sync for BufferCell

impl Unpin for BufferCell

impl UnwindSafe for BufferCell

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ReturnWasmAbi for T where
    T: IntoWasmAbi
[src]

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.