nu_protocol

Enum Value

Source
pub enum Value {
Show 17 variants Bool { val: bool, internal_span: Span, }, Int { val: i64, internal_span: Span, }, Float { val: f64, internal_span: Span, }, String { val: String, internal_span: Span, }, Glob { val: String, no_expand: bool, internal_span: Span, }, Filesize { val: i64, internal_span: Span, }, Duration { val: i64, internal_span: Span, }, Date { val: DateTime<FixedOffset>, internal_span: Span, }, Range { val: Box<Range>, internal_span: Span, }, Record { val: SharedCow<Record>, internal_span: Span, }, List { vals: Vec<Value>, internal_span: Span, }, Closure { val: Box<Closure>, internal_span: Span, }, Error { error: Box<ShellError>, internal_span: Span, }, Binary { val: Vec<u8>, internal_span: Span, }, CellPath { val: CellPath, internal_span: Span, }, Custom { val: Box<dyn CustomValue>, internal_span: Span, }, Nothing { internal_span: Span, },
}
Expand description

Core structured values that pass through the pipeline in Nushell.

Variants§

§

Bool

Fields

§val: bool
§internal_span: Span
§

Int

Fields

§val: i64
§internal_span: Span
§

Float

Fields

§val: f64
§internal_span: Span
§

String

Fields

§internal_span: Span
§

Glob

Fields

§no_expand: bool
§internal_span: Span
§

Filesize

Fields

§val: i64
§internal_span: Span
§

Duration

Fields

§val: i64
§internal_span: Span
§

Date

Fields

§internal_span: Span
§

Range

Fields

§val: Box<Range>
§internal_span: Span
§

Record

Fields

§internal_span: Span
§

List

Fields

§vals: Vec<Value>
§internal_span: Span
§

Closure

Fields

§internal_span: Span
§

Error

Fields

§internal_span: Span
§

Binary

Fields

§val: Vec<u8>
§internal_span: Span
§

CellPath

Fields

§internal_span: Span
§

Custom

Fields

§val: Box<dyn CustomValue>
§internal_span: Span
§

Nothing

Fields

§internal_span: Span

Implementations§

Source§

impl Value

Source

pub fn as_bool(&self) -> Result<bool, ShellError>

Returns the inner bool value or an error if this Value is not a bool

Source

pub fn as_int(&self) -> Result<i64, ShellError>

Returns the inner i64 value or an error if this Value is not an int

Source

pub fn as_float(&self) -> Result<f64, ShellError>

Returns the inner f64 value or an error if this Value is not a float

Source

pub fn coerce_float(&self) -> Result<f64, ShellError>

Returns this Value converted to a f64 or an error if it cannot be converted

Only the following Value cases will return an Ok result:

  • Int
  • Float
for val in Value::test_values() {
    assert_eq!(
        matches!(val, Value::Float { .. } | Value::Int { .. }),
        val.coerce_float().is_ok(),
    );
}
Source

pub fn as_filesize(&self) -> Result<i64, ShellError>

Returns the inner i64 filesize value or an error if this Value is not a filesize

Source

pub fn as_duration(&self) -> Result<i64, ShellError>

Returns the inner i64 duration value or an error if this Value is not a duration

Source

pub fn as_date(&self) -> Result<DateTime<FixedOffset>, ShellError>

Returns the inner DateTime value or an error if this Value is not a date

Source

pub fn as_range(&self) -> Result<Range, ShellError>

Returns a reference to the inner Range value or an error if this Value is not a range

Source

pub fn into_range(self) -> Result<Range, ShellError>

Unwraps the inner Range value or returns an error if this Value is not a range

Source

pub fn as_str(&self) -> Result<&str, ShellError>

Returns a reference to the inner str value or an error if this Value is not a string

Source

pub fn into_string(self) -> Result<String, ShellError>

Unwraps the inner String value or returns an error if this Value is not a string

Source

pub fn coerce_str(&self) -> Result<Cow<'_, str>, ShellError>

Returns this Value converted to a str or an error if it cannot be converted

Only the following Value cases will return an Ok result:

  • Int
  • Float
  • String
  • Glob
  • Binary (only if valid utf-8)
  • Date
for val in Value::test_values() {
    assert_eq!(
        matches!(
            val,
            Value::Int { .. }
                | Value::Float { .. }
                | Value::String { .. }
                | Value::Glob { .. }
                | Value::Binary { .. }
                | Value::Date { .. }
        ),
        val.coerce_str().is_ok(),
    );
}
Source

pub fn coerce_string(&self) -> Result<String, ShellError>

Returns this Value converted to a String or an error if it cannot be converted

§Note

This function is equivalent to value.coerce_str().map(Cow::into_owned) which might allocate a new String.

To avoid this allocation, prefer coerce_str if you do not need an owned String, or coerce_into_string if you do not need to keep the original Value around.

Only the following Value cases will return an Ok result:

  • Int
  • Float
  • String
  • Glob
  • Binary (only if valid utf-8)
  • Date
for val in Value::test_values() {
    assert_eq!(
        matches!(
            val,
            Value::Int { .. }
                | Value::Float { .. }
                | Value::String { .. }
                | Value::Glob { .. }
                | Value::Binary { .. }
                | Value::Date { .. }
        ),
        val.coerce_string().is_ok(),
    );
}
Source

pub fn coerce_into_string(self) -> Result<String, ShellError>

Returns this Value converted to a String or an error if it cannot be converted

Only the following Value cases will return an Ok result:

  • Int
  • Float
  • String
  • Glob
  • Binary (only if valid utf-8)
  • Date
for val in Value::test_values() {
    assert_eq!(
        matches!(
            val,
            Value::Int { .. }
                | Value::Float { .. }
                | Value::String { .. }
                | Value::Glob { .. }
                | Value::Binary { .. }
                | Value::Date { .. }
        ),
        val.coerce_into_string().is_ok(),
    );
}
Source

pub fn as_char(&self) -> Result<char, ShellError>

Returns this Value as a char or an error if it is not a single character string

Source

pub fn to_path(&self) -> Result<PathBuf, ShellError>

Converts this Value to a PathBuf or returns an error if it is not a string

Source

pub fn as_record(&self) -> Result<&Record, ShellError>

Returns a reference to the inner Record value or an error if this Value is not a record

Source

pub fn into_record(self) -> Result<Record, ShellError>

Unwraps the inner Record value or returns an error if this Value is not a record

Source

pub fn as_list(&self) -> Result<&[Value], ShellError>

Returns a reference to the inner list slice or an error if this Value is not a list

Source

pub fn into_list(self) -> Result<Vec<Value>, ShellError>

Unwraps the inner list Vec or returns an error if this Value is not a list

Source

pub fn as_closure(&self) -> Result<&Closure, ShellError>

Returns a reference to the inner Closure value or an error if this Value is not a closure

Source

pub fn into_closure(self) -> Result<Closure, ShellError>

Unwraps the inner Closure value or returns an error if this Value is not a closure

Source

pub fn as_binary(&self) -> Result<&[u8], ShellError>

Returns a reference to the inner binary slice or an error if this Value is not a binary value

Source

pub fn into_binary(self) -> Result<Vec<u8>, ShellError>

Unwraps the inner binary Vec or returns an error if this Value is not a binary value

Source

pub fn coerce_binary(&self) -> Result<&[u8], ShellError>

Returns this Value as a u8 slice or an error if it cannot be converted

Prefer coerce_into_binary if you do not need to keep the original Value around.

Only the following Value cases will return an Ok result:

  • Binary
  • String
for val in Value::test_values() {
    assert_eq!(
        matches!(val, Value::Binary { .. } | Value::String { .. }),
        val.coerce_binary().is_ok(),
    );
}
Source

pub fn coerce_into_binary(self) -> Result<Vec<u8>, ShellError>

Returns this Value as a Vec<u8> or an error if it cannot be converted

Only the following Value cases will return an Ok result:

  • Binary
  • String
for val in Value::test_values() {
    assert_eq!(
        matches!(val, Value::Binary { .. } | Value::String { .. }),
        val.coerce_into_binary().is_ok(),
    );
}
Source

pub fn as_cell_path(&self) -> Result<&CellPath, ShellError>

Returns a reference to the inner CellPath value or an error if this Value is not a cell path

Source

pub fn into_cell_path(self) -> Result<CellPath, ShellError>

Unwraps the inner CellPath value or returns an error if this Value is not a cell path

Source

pub fn as_custom_value(&self) -> Result<&dyn CustomValue, ShellError>

Returns a reference to the inner CustomValue trait object or an error if this Value is not a custom value

Source

pub fn into_custom_value(self) -> Result<Box<dyn CustomValue>, ShellError>

Unwraps the inner CustomValue trait object or returns an error if this Value is not a custom value

Source

pub fn span(&self) -> Span

Get the span for the current value

Source

pub fn set_span(&mut self, new_span: Span)

Set the value’s span to a new span

Source

pub fn with_span(self, new_span: Span) -> Value

Update the value with a new span

Source

pub fn get_type(&self) -> Type

Get the type of the current Value

Source

pub fn get_data_by_key(&self, name: &str) -> Option<Value>

Source

pub fn to_expanded_string(&self, separator: &str, config: &Config) -> String

Converts this Value to a string according to the given Config and separator

This functions recurses into records and lists, returning a string that contains the stringified form of all nested Values.

Source

pub fn to_abbreviated_string(&self, config: &Config) -> String

Converts this Value to a string according to the given Config

This functions does not recurse into records and lists. Instead, it will shorten the first list or record it finds like so:

  • “[table {n} rows]”
  • “[list {n} items]”
  • “[record {n} fields]”
Source

pub fn to_parsable_string(&self, separator: &str, config: &Config) -> String

Converts this Value to a string according to the given Config and separator

This function adds quotes around strings, so that the returned string can be parsed by nushell. The other Value cases are already parsable when converted strings or are not yet handled by this function.

This functions behaves like to_expanded_string and will recurse into records and lists.

Source

pub fn to_debug_string(&self) -> String

Convert this Value to a debug string

In general, this function should only be used for debug purposes, and the resulting string should not be displayed to the user (not even in an error).

Source

pub fn follow_cell_path( self, cell_path: &[PathMember], insensitive: bool, ) -> Result<Value, ShellError>

Follow a given cell path into the value: for example accessing select elements in a stream or list

Source

pub fn upsert_cell_path( &mut self, cell_path: &[PathMember], callback: Box<dyn FnOnce(&Value) -> Value>, ) -> Result<(), ShellError>

Follow a given cell path into the value: for example accessing select elements in a stream or list

Source

pub fn upsert_data_at_cell_path( &mut self, cell_path: &[PathMember], new_val: Value, ) -> Result<(), ShellError>

Source

pub fn update_cell_path<'a>( &mut self, cell_path: &[PathMember], callback: Box<dyn FnOnce(&Value) -> Value + 'a>, ) -> Result<(), ShellError>

Follow a given cell path into the value: for example accessing select elements in a stream or list

Source

pub fn update_data_at_cell_path( &mut self, cell_path: &[PathMember], new_val: Value, ) -> Result<(), ShellError>

Source

pub fn remove_data_at_cell_path( &mut self, cell_path: &[PathMember], ) -> Result<(), ShellError>

Source

pub fn insert_data_at_cell_path( &mut self, cell_path: &[PathMember], new_val: Value, head_span: Span, ) -> Result<(), ShellError>

Source

pub fn recurse_mut<E>( &mut self, f: &mut impl FnMut(&mut Value) -> Result<(), E>, ) -> Result<(), E>

Visits all values contained within the value (including this value) with a mutable reference given to the closure.

If the closure returns Err, the traversal will stop.

Captures of closure values are currently visited, as they are values owned by the closure.

Source

pub fn is_empty(&self) -> bool

Check if the content is empty

Source

pub fn is_nothing(&self) -> bool

Source

pub fn is_error(&self) -> bool

Source

pub fn is_true(&self) -> bool

Source

pub fn is_false(&self) -> bool

Source

pub fn columns(&self) -> impl Iterator<Item = &String>

Source

pub fn bool(val: bool, span: Span) -> Value

Source

pub fn int(val: i64, span: Span) -> Value

Source

pub fn float(val: f64, span: Span) -> Value

Source

pub fn filesize(val: i64, span: Span) -> Value

Source

pub fn duration(val: i64, span: Span) -> Value

Source

pub fn date(val: DateTime<FixedOffset>, span: Span) -> Value

Source

pub fn range(val: Range, span: Span) -> Value

Source

pub fn string(val: impl Into<String>, span: Span) -> Value

Source

pub fn glob(val: impl Into<String>, no_expand: bool, span: Span) -> Value

Source

pub fn record(val: Record, span: Span) -> Value

Source

pub fn list(vals: Vec<Value>, span: Span) -> Value

Source

pub fn closure(val: Closure, span: Span) -> Value

Source

pub fn nothing(span: Span) -> Value

Create a new Nothing value

Source

pub fn error(error: ShellError, span: Span) -> Value

Source

pub fn binary(val: impl Into<Vec<u8>>, span: Span) -> Value

Source

pub fn cell_path(val: CellPath, span: Span) -> Value

Source

pub fn custom(val: Box<dyn CustomValue>, span: Span) -> Value

Source

pub fn test_bool(val: bool) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_int(val: i64) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_float(val: f64) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_filesize(val: i64) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_duration(val: i64) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_date(val: DateTime<FixedOffset>) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_range(val: Range) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_string(val: impl Into<String>) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_glob(val: impl Into<String>) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_record(val: Record) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_list(vals: Vec<Value>) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_closure(val: Closure) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_nothing() -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_binary(val: impl Into<Vec<u8>>) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_cell_path(val: CellPath) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_custom_value(val: Box<dyn CustomValue>) -> Value

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Source

pub fn test_values() -> Vec<Value>

Note: Only use this for test data, not live data, as it will point into unknown source when used in errors.

Returns a Vec containing one of each value case (Value::Int, Value::String, etc.) except for Value::CustomValue.

Source§

impl Value

Source

pub fn add( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn append( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn sub( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn mul( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn div( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn modulo( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn floor_div( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn lt(&self, op: Span, rhs: &Value, span: Span) -> Result<Value, ShellError>

Source

pub fn lte( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn gt(&self, op: Span, rhs: &Value, span: Span) -> Result<Value, ShellError>

Source

pub fn gte( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn eq(&self, op: Span, rhs: &Value, span: Span) -> Result<Value, ShellError>

Source

pub fn ne(&self, op: Span, rhs: &Value, span: Span) -> Result<Value, ShellError>

Source

pub fn in(&self, op: Span, rhs: &Value, span: Span) -> Result<Value, ShellError>

Source

pub fn not_in( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn regex_match( &self, engine_state: &EngineState, op: Span, rhs: &Value, invert: bool, span: Span, ) -> Result<Value, ShellError>

Source

pub fn starts_with( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn ends_with( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn bit_shl( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn bit_shr( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn bit_or( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn bit_xor( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn bit_and( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn and( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn or(&self, op: Span, rhs: &Value, span: Span) -> Result<Value, ShellError>

Source

pub fn xor( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Source

pub fn pow( &self, op: Span, rhs: &Value, span: Span, ) -> Result<Value, ShellError>

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Value

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FromValue for Value

Source§

fn from_value(v: Value) -> Result<Self, ShellError>

Loads a value from a Value. Read more
Source§

fn expected_type() -> Type

Expected Value type. Read more
Source§

impl IntoValue for Value

Source§

fn into_value(self, span: Span) -> Value

Converts the given value to a Value.
Source§

impl PartialEq for Value

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Value

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Value

§

impl !RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl !UnwindSafe for Value

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<V> IntoPipelineData for V
where V: Into<Value>,

Source§

impl<T> IntoSpanned for T

Source§

fn into_spanned(self, span: Span) -> Spanned<T>

Wrap items together with a span into Spanned. Read more
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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

impl<T> TryIntoValue for T
where T: IntoValue,

Source§

fn try_into_value(self, span: Span) -> Result<Value, ShellError>

Tries to convert the given value into a Value.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,