[−][src]Enum nu_protocol::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
A date value, in UTC
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 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]
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]
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]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Ord for Primitive[src]
fn cmp(&self, other: &Primitive) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl PartialEq<Primitive> for Primitive[src]
impl PartialOrd<Primitive> for Primitive[src]
fn partial_cmp(&self, other: &Primitive) -> Option<Ordering>[src]
fn lt(&self, other: &Primitive) -> bool[src]
fn le(&self, other: &Primitive) -> bool[src]
fn gt(&self, other: &Primitive) -> bool[src]
fn ge(&self, other: &Primitive) -> bool[src]
impl PrettyDebug for Primitive[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 plain_string(&self, width: usize) -> String[src]
fn colored_string(&self, width: usize) -> String[src]
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]
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
impl Send for Primitive
impl Sync for Primitive
impl Unpin for Primitive
impl UnwindSafe for Primitive
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,
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,
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,
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]
fn spanned(self, span: impl Into<Span>) -> Spanned<Self>[src]
fn spanned_unknown(self) -> Spanned<Self>[src]
impl<T> TaggedItem for T[src]
fn tagged(self, tag: impl Into<Tag>) -> Tagged<Self>[src]
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.
fn to_owned(&self) -> T[src]
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.
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>,