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,
}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
Expand description
An empty value
Int(BigInt)Expand description
A “big int”, an integer with arbitrarily large size (aka not limited to 64-bit)
Decimal(BigDecimal)Expand description
A “big decimal”, an decimal number with arbitrarily large size (aka not limited to 64-bit)
Filesize(BigInt)Expand description
A count in the number of bytes, used as a filesize
String(String)Expand description
A string value
ColumnPath(ColumnPath)Expand description
A path to travel to reach a value in a table
GlobPattern(String)Expand description
A glob pattern, eg foo*
Boolean(bool)Expand description
A boolean value
Date(DateTime<FixedOffset>)Expand description
A date value
Duration(BigInt)Expand description
A count in the number of nanoseconds
Expand description
A range of values
FilePath(PathBuf)Expand description
A file path
Expand description
A vector of raw binary data
Expand description
Beginning of stream marker, a pseudo-value not intended for tables
Expand description
End of stream marker, a pseudo-value not intended for tables
Implementations
impl Primitive[src]
impl Primitive[src]pub fn as_char(&self, span: Span) -> Result<char, ShellError>[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]
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]
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_f64(&self, span: Span) -> Result<f64, ShellError>[src]
pub fn as_f64(&self, span: Span) -> Result<f64, ShellError>[src]Converts a primitive value to a f64, 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]
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]
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]
Trait Implementations
impl<'de> Deserialize<'de> for Primitive[src]
impl<'de> Deserialize<'de> for Primitive[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]Deserialize this value from the given Serde deserializer. Read more
impl From<BigDecimal> for Primitive[src]
impl From<BigDecimal> for Primitive[src]fn from(decimal: BigDecimal) -> Primitive[src]
fn from(decimal: BigDecimal) -> Primitive[src]Helper to convert from decimals to a Primitive value
impl Ord for Primitive[src]
impl Ord for Primitive[src]impl PartialOrd<Primitive> for Primitive[src]
impl PartialOrd<Primitive> for Primitive[src]fn partial_cmp(&self, other: &Primitive) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &Primitive) -> Option<Ordering>[src]This method returns an ordering between self and other values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl PrettyDebug for Primitive[src]
impl PrettyDebug for Primitive[src]fn pretty(&self) -> DebugDocBuilder[src]
fn pretty(&self) -> DebugDocBuilder[src]Get a Primitive value ready to be pretty-printed
fn to_doc(&self) -> DebugDoc[src]
fn pretty_doc(
&self
) -> Doc<'static, BoxDoc<'static, ShellAnnotation>, ShellAnnotation>[src]
&self
) -> Doc<'static, BoxDoc<'static, ShellAnnotation>, ShellAnnotation>
fn pretty_builder(&self) -> DocBuilder<'static, BoxAllocator, ShellAnnotation>[src]
fn display(&self) -> String[src]
fn display(&self) -> String[src]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
fn plain_string(&self, width: usize) -> String[src]
fn colored_string(&self, width: usize) -> String[src]
impl PrettyType for Primitive[src]
impl PrettyType for Primitive[src]fn pretty_type(&self) -> DebugDocBuilder[src]
fn pretty_type(&self) -> DebugDocBuilder[src]Find the type of the Value and prepare it for pretty-printing
impl ShellTypeName for Primitive[src]
impl ShellTypeName for Primitive[src]impl Eq for Primitive[src]
impl StructuralEq for Primitive[src]
impl StructuralPartialEq for Primitive[src]
Auto Trait Implementations
impl RefUnwindSafe for Primitive
impl Send for Primitive
impl Sync for Primitive
impl Unpin for Primitive
impl UnwindSafe for Primitive
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]pub fn equivalent(&self, key: &K) -> bool[src]
pub fn equivalent(&self, key: &K) -> bool[src]Compare self to key and return true if they are equal.
impl<T> PrettyDebugWithSource for T where
T: PrettyDebug, [src]
impl<T> PrettyDebugWithSource for T where
T: PrettyDebug, [src]pub fn pretty_debug(&self, _source: &str) -> DebugDocBuilder[src]
fn refined_pretty_debug(
&self,
_refine: PrettyDebugRefineKind,
source: &str
) -> DebugDocBuilder[src]
&self,
_refine: PrettyDebugRefineKind,
source: &str
) -> DebugDocBuilder
fn debug(&self, source: impl Into<Text>) -> String where
Self: Clone, [src]
Self: Clone,
fn debuggable(self, source: impl Into<Text>) -> DebuggableWithSource<Self>[src]
impl<T> SpannedItem for T[src]
impl<T> SpannedItem for T[src]impl<T> TaggedItem for T[src]
impl<T> TaggedItem for T[src]impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,