[−][src]Enum nu_protocol::value::primitive::Primitive
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
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(u64)
A count in the number of bytes, used as a filesize
String(String)
A string value
Line(String)
A string value with an implied carriage return (or cr/lf) ending
ColumnPath(ColumnPath)
A path to travel to reach a value in a table
Pattern(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
A range of values
Path(PathBuf)
A file path
A vector of raw binary data
Beginning of stream marker, a pseudo-value not intended for tables
End of stream marker, a pseudo-value not intended for tables
Implementations
impl Primitive
[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_i64(&self, span: Span) -> Result<i64, 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]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Primitive
[src]
impl Eq for Primitive
[src]
impl From<&'_ str> for Primitive
[src]
impl From<BigDecimal> for Primitive
[src]
pub fn from(decimal: BigDecimal) -> Primitive
[src]
Helper to convert from decimals to a Primitive value
impl From<BigInt> for Primitive
[src]
impl From<Duration> for Primitive
[src]
impl From<String> for Primitive
[src]
impl From<bool> for Primitive
[src]
impl From<f64> for Primitive
[src]
impl Hash for Primitive
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Primitive
[src]
pub fn cmp(&self, other: &Primitive) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Primitive> for Primitive
[src]
impl PartialOrd<Primitive> for Primitive
[src]
pub fn partial_cmp(&self, other: &Primitive) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Primitive) -> bool
[src]
pub fn le(&self, other: &Primitive) -> bool
[src]
pub fn gt(&self, other: &Primitive) -> bool
[src]
pub fn ge(&self, other: &Primitive) -> bool
[src]
impl PrettyDebug for Primitive
[src]
pub fn pretty(&self) -> DebugDocBuilder
[src]
Get a Primitive value ready to be pretty-printed
pub fn to_doc(&self) -> DebugDoc
[src]
pub fn pretty_doc(
&self
) -> Doc<'static, BoxDoc<'static, ShellAnnotation>, ShellAnnotation>
[src]
&self
) -> Doc<'static, BoxDoc<'static, ShellAnnotation>, ShellAnnotation>
pub fn pretty_builder(
&self
) -> DocBuilder<'static, BoxAllocator, ShellAnnotation>
[src]
&self
) -> DocBuilder<'static, BoxAllocator, ShellAnnotation>
pub fn display(&self) -> String
[src]
pub fn plain_string(&self, width: usize) -> String
[src]
pub fn colored_string(&self, width: usize) -> String
[src]
impl PrettyType for Primitive
[src]
pub fn pretty_type(&self) -> DebugDocBuilder
[src]
Find the type of the Value and prepare it for pretty-printing
impl Serialize for Primitive
[src]
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl ShellTypeName for Primitive
[src]
impl StructuralEq for Primitive
[src]
impl StructuralPartialEq for Primitive
[src]
Auto Trait Implementations
impl RefUnwindSafe for Primitive
[src]
impl Send for Primitive
[src]
impl Sync for Primitive
[src]
impl Unpin for Primitive
[src]
impl UnwindSafe for Primitive
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> PrettyDebugWithSource for T where
T: PrettyDebug,
[src]
T: PrettyDebug,
pub fn pretty_debug(&self, _source: &str) -> DebugDocBuilder
[src]
pub fn refined_pretty_debug(
&self,
_refine: PrettyDebugRefineKind,
source: &str
) -> DebugDocBuilder
[src]
&self,
_refine: PrettyDebugRefineKind,
source: &str
) -> DebugDocBuilder
pub fn debug(&self, source: impl Into<Text>) -> String where
Self: Clone,
[src]
Self: Clone,
pub fn debuggable(self, source: impl Into<Text>) -> DebuggableWithSource<Self>
[src]
impl<T> SpannedItem for T
[src]
pub fn spanned(self, span: impl Into<Span>) -> Spanned<Self>
[src]
pub fn spanned_unknown(self) -> Spanned<Self>
[src]
impl<T> TaggedItem for T
[src]
pub fn tagged(self, tag: impl Into<Tag>) -> Tagged<Self>
[src]
pub fn tagged_unknown(self) -> Tagged<Self>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,