Enum nu_protocol::value::primitive::Primitive[][src]

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

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(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(BigInt)

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

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

impl Primitive[src]

pub fn as_char(&self, span: Span) -> Result<char, ShellError>[src]

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

pub fn as_usize(&self, span: Span) -> Result<usize, ShellError>[src]

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

pub fn as_u64(&self, span: Span) -> Result<u64, ShellError>[src]

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

pub fn as_i64(&self, span: Span) -> Result<i64, ShellError>[src]

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

pub fn as_u32(&self, span: Span) -> Result<u32, ShellError>[src]

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

pub fn as_i32(&self, span: Span) -> Result<i32, ShellError>[src]

pub fn as_i16(&self, span: Span) -> Result<i16, ShellError>[src]

pub fn into_chrono_duration(self, span: Span) -> Result<Duration, ShellError>[src]

pub fn into_string(self, span: Span) -> Result<String, ShellError>[src]

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

Returns true if the value is empty

Trait Implementations

impl Clone for Primitive[src]

impl Debug for Primitive[src]

impl<'de> Deserialize<'de> for Primitive[src]

impl Display for Primitive[src]

impl Eq for Primitive[src]

impl From<&'_ str> for Primitive[src]

fn from(s: &str) -> Primitive[src]

Helper to convert from string slices to a primitive

impl From<BigDecimal> for Primitive[src]

fn from(decimal: BigDecimal) -> Primitive[src]

Helper to convert from decimals to a Primitive value

impl From<BigInt> for Primitive[src]

fn from(int: BigInt) -> Primitive[src]

Helper to convert from integers to a Primitive value

impl From<Duration> for Primitive[src]

impl From<String> for Primitive[src]

fn from(s: String) -> Primitive[src]

Helper to convert from Strings to a primitive

impl From<bool> for Primitive[src]

fn from(b: bool) -> Primitive[src]

Helper to convert from boolean to a primitive

impl From<f64> for Primitive[src]

fn from(float: f64) -> Primitive[src]

Helper to convert from 64-bit float to a Primitive value

impl Hash for Primitive[src]

impl Ord for Primitive[src]

impl PartialEq<Primitive> for Primitive[src]

impl PartialOrd<Primitive> for Primitive[src]

impl PrettyDebug for Primitive[src]

fn pretty(&self) -> DebugDocBuilder[src]

Get a Primitive value ready to be pretty-printed

impl PrettyType for Primitive[src]

fn pretty_type(&self) -> DebugDocBuilder[src]

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

impl Serialize for Primitive[src]

impl ShellTypeName for Primitive[src]

fn type_name(&self) -> &'static str[src]

Get the name of the type of a Primitive value

impl StructuralEq for Primitive[src]

impl StructuralPartialEq for Primitive[src]

Auto Trait Implementations

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

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

impl<T> PrettyDebugWithSource for T where
    T: PrettyDebug
[src]

impl<T> SpannedItem for T[src]

impl<T> TaggedItem for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.