Struct nu_protocol::value::Value[][src]

pub struct Value {
    pub value: UntaggedValue,
    pub tag: Tag,
}
Expand description

The fundamental structured value that flows through the pipeline, with associated metadata

Fields

value: UntaggedValuetag: Tag

Implementations

impl Value[src]

pub fn new(untagged_value: UntaggedValue, the_tag: Tag) -> Self[src]

Helper to create a Value

pub fn anchor(&self) -> Option<AnchorLocation>[src]

Get the corresponding anchor (originating location) for the Value

pub fn anchor_name(&self) -> Option<String>[src]

Get the name (url, filepath, etc) behind an anchor for the Value

pub fn tag(&self) -> Tag[src]

Get the metadata for the Value

pub fn error(e: ShellError) -> Value[src]

pub fn as_string(&self) -> Result<String, ShellError>[src]

View the Value as a string, if possible

pub fn as_filepath(&self) -> Result<PathBuf, ShellError>[src]

View the Value as a FilePath (PathBuf), if possible

pub fn as_int(&self) -> Result<BigInt, ShellError>[src]

View the Value as a Int (BigInt), if possible

pub fn as_filesize(&self) -> Result<BigInt, ShellError>[src]

View the Value as a Filesize (BigInt), if possible

pub fn as_duration(&self) -> Result<BigInt, ShellError>[src]

View the Value as a Duration (BigInt), if possible

pub fn as_decimal(&self) -> Result<BigDecimal, ShellError>[src]

View the Value as a Decimal (BigDecimal), if possible

pub fn convert_to_string(&self) -> String[src]

pub fn format(&self, fmt: &str) -> Result<String, ShellError>[src]

pub fn as_forgiving_string(&self) -> Result<&str, ShellError>[src]

View into the borrowed string contents of a Value, if possible

pub fn as_path(&self) -> Result<PathBuf, ShellError>[src]

View the Value as a path, if possible

pub fn as_primitive(&self) -> Result<Primitive, ShellError>[src]

View the Value as a Primitive value, if possible

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

View the Value as a Primitive value, if possible

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

View the Value as char, if possible

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

View the Value as unsigned size, if possible

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

View the Value as unsigned 64-bit, if possible

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

View the Value as signed 64-bit, if possible

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

View the Value as unsigned 32-bit, if possible

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

View the Value as signed 32-bit, if possible

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

View the Value as signed 16-bit, if possible

pub fn as_bool(&self) -> Result<bool, ShellError>[src]

View the Value as boolean, if possible

pub fn table_entries(&self) -> TableValueIter<'_>

Notable traits for TableValueIter<'a>

impl<'a> Iterator for TableValueIter<'a> type Item = &'a Value;
[src]

Returns an iterator of the values rows

pub fn row_entries(&self) -> RowValueIter<'_>

Notable traits for RowValueIter<'a>

impl<'a> Iterator for RowValueIter<'a> type Item = (&'a String, &'a Value);
[src]

Returns an iterator of the value’s cells

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

Returns true if the value is empty

pub fn nothing() -> Value[src]

Methods from Deref<Target = UntaggedValue>

pub fn data_descriptors(&self) -> Vec<String>[src]

Get the corresponding descriptors (column names) associated with this value

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

Returns true if this value represents boolean true

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

Returns true if this value represents a filesize

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

Returns true if this value represents a duration

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

Returns true if this value represents a table

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

Returns true if this value represents a row

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

Returns true if this value represents a string

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

Returns true if the value represents something other than Nothing

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

Returns true if the value represents Nothing

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

Returns true if the value represents an error

pub fn expect_error(&self) -> ShellError[src]

Expect this value to be an error and return it

pub fn expect_string(&self) -> &str[src]

Expect this value to be a string and return it

pub fn expect_int(&self) -> i64[src]

Expect this value to be an integer and return it

Trait Implementations

impl Clone for Value[src]

fn clone(&self) -> Value[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Value[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Deref for Value[src]

Overload deferencing to give back the UntaggedValue inside of a Value

type Target = UntaggedValue

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl<'de> Deserialize<'de> for Value[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<&'_ str> for Value[src]

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

Performs the conversion.

impl<'a> From<&'a Value> for &'a UntaggedValue[src]

Convert a borrowed Value into a borrowed UntaggedValue

fn from(x: &'a Value) -> Self[src]

Performs the conversion.

impl From<String> for Value[src]

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

Performs the conversion.

impl From<TaggedDictBuilder> for Value[src]

fn from(input: TaggedDictBuilder) -> Value[src]

Convert a builder into a tagged Value

impl From<UntaggedValue> for Value[src]

fn from(value: UntaggedValue) -> Value[src]

Convert an UntaggedValue into a Value with a default tag

impl From<Value> for ReturnValue[src]

fn from(v: Value) -> Self[src]

Performs the conversion.

impl From<Value> for UntaggedValue[src]

fn from(v: Value) -> UntaggedValue[src]

Convert a Value into an UntaggedValue

impl From<bool> for Value[src]

fn from(s: bool) -> Value[src]

Performs the conversion.

impl HasSpan for Value[src]

fn span(&self) -> Span[src]

Return the corresponding Span for the Value

impl Hash for Value[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

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

impl Ord for Value[src]

fn cmp(&self, other: &Value) -> Ordering[src]

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

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<Value> for Dictionary[src]

fn eq(&self, other: &Value) -> bool[src]

Test a dictionary against a Value for equality

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialEq<Value> for Value[src]

fn eq(&self, other: &Self) -> bool[src]

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

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialOrd<Value> for Value[src]

fn partial_cmp(&self, other: &Value) -> 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) -> bool
1.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) -> bool
1.0.0[src]

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

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

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

impl PrettyDebug for &Value[src]

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

Get a borrowed Value ready to be pretty-printed

fn to_doc(&self) -> DebugDoc[src]

fn pretty_doc(
    &self
) -> Doc<'static, BoxDoc<'static, ShellAnnotation>, ShellAnnotation>
[src]

fn pretty_builder(&self) -> DocBuilder<'static, BoxAllocator, ShellAnnotation>[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 PrettyDebug for Value[src]

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

Get a Value ready to be pretty-printed

fn to_doc(&self) -> DebugDoc[src]

fn pretty_doc(
    &self
) -> Doc<'static, BoxDoc<'static, ShellAnnotation>, ShellAnnotation>
[src]

fn pretty_builder(&self) -> DocBuilder<'static, BoxAllocator, ShellAnnotation>[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 Serialize for Value[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl ShellTypeName for Value[src]

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

Get the type name for the Value

impl<'a> TryFrom<&'a Value> for &'a Dictionary[src]

fn try_from(value: &'a Value) -> Result<&'a Dictionary, ShellError>[src]

Convert to a dictionary, if possible

type Error = ShellError

The type returned in the event of a conversion error.

impl Eq for Value[src]

impl StructuralEq for Value[src]

Auto Trait Implementations

impl RefUnwindSafe for Value

impl Send for Value

impl Sync for Value

impl Unpin for Value

impl UnwindSafe for Value

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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]

pub fn equivalent(&self, key: &K) -> bool[src]

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

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> HasFallibleSpan for T where
    T: HasSpan
[src]

pub fn maybe_span(&self) -> Option<Span>[src]

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> IntoSpanned for T where
    T: HasFallibleSpan
[src]

type Output = T

pub fn into_spanned(self, _span: impl Into<Span>) -> <T as IntoSpanned>::Output[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]

fn debug(&self, source: impl Into<Text>) -> String where
    Self: Clone
[src]

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]

Converts a value into a Spanned value

fn spanned_unknown(self) -> Spanned<Self>[src]

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

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]

type Owned = T

The resulting type after obtaining ownership.

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]

🔬 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, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]