pub enum Primitive {
Show 16 variants Nothing, Int(i64), BigInt(BigInt), Decimal(BigDecimal), Filesize(u64), String(String), ColumnPath(ColumnPath), GlobPattern(String), Boolean(bool), Date(DateTime<FixedOffset>), Duration(BigInt), Range(Box<Range>), FilePath(PathBuf), Binary(Vec<u8>), BeginningOfStream, EndOfStream,
}
Expand description

The most fundamental of structured values in Nu are the Primitive values. These values represent types like integers, strings, booleans, dates, etc that are then used as the building blocks of more complex structures.

Primitives also include marker values BeginningOfStream and EndOfStream which denote a change of condition in the stream

Variants

Nothing

An empty value

Int(i64)

A common integer

BigInt(BigInt)

A “big int”, an integer with arbitrarily large size (aka not limited to 64-bit)

Decimal(BigDecimal)

A “big decimal”, an decimal number with arbitrarily large size (aka not limited to 64-bit)

Filesize(u64)

A count in the number of bytes, used as a filesize

String(String)

A string value

ColumnPath(ColumnPath)

A path to travel to reach a value in a table

GlobPattern(String)

A glob pattern, eg foo*

Boolean(bool)

A boolean value

Date(DateTime<FixedOffset>)

A date value

Duration(BigInt)

A count in the number of nanoseconds

Range(Box<Range>)

A range of values

FilePath(PathBuf)

A file path

Binary(Vec<u8>)

A vector of raw binary data

BeginningOfStream

Beginning of stream marker, a pseudo-value not intended for tables

EndOfStream

End of stream marker, a pseudo-value not intended for tables

Implementations

Converts a primitive value to a char, if possible. Uses a span to build an error if the conversion isn’t possible.

Converts a primitive value to a u64, if possible. Uses a span to build an error if the conversion isn’t possible.

Converts a primitive value to a u64, if possible. Uses a span to build an error if the conversion isn’t possible.

Converts a primitive value to a f64, if possible. Uses a span to build an error if the conversion isn’t possible.

Converts a primitive value to a i64, if possible. Uses a span to build an error if the conversion isn’t possible.

Converts a primitive value to a u32, if possible. Uses a span to build an error if the conversion isn’t possible.

Returns true if the value is empty

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Helper to convert from string slices to a primitive

Helper to convert from decimals to a Primitive value

Helper to convert from integers to a Primitive value

Performs the conversion.

Helper to convert from Strings to a primitive

Helper to convert from boolean to a primitive

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Get a Primitive value ready to be pretty-printed

A convenience method that prints out the document without colors in 70 columns. Generally, you should use plain_string or colored_string if possible, but display() can be useful for trace lines and things like that, where you don’t have control over the terminal. Read more

Find the type of the Value and prepare it for pretty-printing

Serialize this value into the given Serde serializer. Read more

Get the name of the type of a Primitive value

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

Converts a value into a Spanned value

Converts a value into a Spanned value, using an unknown Span

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.