Enum nu_protocol::Value

source ·
pub enum Value {
Show 18 variants Bool { val: bool, internal_span: Span, }, Int { val: i64, internal_span: Span, }, Float { val: f64, internal_span: Span, }, Filesize { val: i64, internal_span: Span, }, Duration { val: i64, internal_span: Span, }, Date { val: DateTime<FixedOffset>, internal_span: Span, }, Range { val: Range, internal_span: Span, }, String { val: String, internal_span: Span, }, Glob { val: String, no_expand: bool, internal_span: Span, }, Record { val: SharedCow<Record>, internal_span: Span, }, List { vals: Vec<Value>, internal_span: Span, }, Closure { val: Closure, internal_span: Span, }, Nothing { 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, }, LazyRecord { val: Box<dyn for<'a> LazyRecord<'a>>, 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
§

Filesize

Fields

§val: i64
§internal_span: Span
§

Duration

Fields

§val: i64
§internal_span: Span
§

Date

Fields

§internal_span: Span
§

Range

Fields

§val: Range
§internal_span: Span
§

String

Fields

§internal_span: Span
§

Glob

Fields

§no_expand: bool
§internal_span: Span
§

Record

Fields

§internal_span: Span
§

List

Fields

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

Closure

Fields

§internal_span: Span
§

Nothing

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
§

LazyRecord

Fields

§val: Box<dyn for<'a> LazyRecord<'a>>
§internal_span: Span

Implementations§

source§

impl Value

source

pub fn parse_as_config( &mut self, existing_config: &Config ) -> (Config, Option<ShellError>)

Parse the given Value as a configuration record, and recover encountered mistakes

If any given (sub)value is detected as impossible, this value will be restored to the value in existing_config, thus mutates self.

Returns a new Config (that is in a valid state) and if encountered the ShellError containing all observed inner errors.

source§

impl Value

source

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

source

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

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
  • Binary (only if valid utf-8)
  • Date
for val in Value::test_values() {
    assert_eq!(
        matches!(
            val,
            Value::Int { .. }
                | Value::Float { .. }
                | Value::String { .. }
                | 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
  • Binary (only if valid utf-8)
  • Date
for val in Value::test_values() {
    assert_eq!(
        matches!(
            val,
            Value::Int { .. }
                | Value::Float { .. }
                | Value::String { .. }
                | 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
  • Binary (only if valid utf-8)
  • Date
for val in Value::test_values() {
    assert_eq!(
        matches!(
            val,
            Value::Int { .. }
                | Value::Float { .. }
                | Value::String { .. }
                | 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 as_lazy_record(&self) -> Result<&dyn for<'a> LazyRecord<'a>, ShellError>

Returns a reference to the inner LazyRecord trait object or an error if this Value is not a lazy record

source

pub fn into_lazy_record( self ) -> Result<Box<dyn for<'a> LazyRecord<'a>>, ShellError>

Unwraps the inner LazyRecord trait object or returns an error if this Value is not a lazy record

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.

If collecting lazy records to check them as well is desirable, make sure to do it in your closure. The traversal continues on whatever modifications you make during the closure. 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 lazy_record(val: Box<dyn for<'a> LazyRecord<'a>>, 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_lazy_record(val: Box<dyn for<'a> LazyRecord<'a>>) -> 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::LazyRecord and 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 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 modulo( &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§

impl PartialEq for Value

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method 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

This method 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

This method 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

This method 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> 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 italicized
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.
§

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,

§

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

§

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

§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,