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

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

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 as_string(&self) -> Result<String, ShellError>[src]

View the Value as a string, 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_u64(&self) -> Result<u64, ShellError>[src]

View the Value as unsigned 64-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]

impl Debug for Value[src]

impl Deref for Value[src]

Overload deferencing to give back the UntaggedValue inside of a Value

type Target = UntaggedValue

The resulting type after dereferencing.

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

impl Eq for Value[src]

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

impl From<String> for Value[src]

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]

impl From<Value> for UntaggedValue[src]

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

Convert a Value into an UntaggedValue

impl From<bool> for Value[src]

impl HasSpan for Value[src]

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

Return the corresponding Span for the Value

impl Hash for Value[src]

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

Convert a borrowed Value into a borrowed UntaggedValue

impl Ord for Value[src]

impl PartialEq<Value> for Dictionary[src]

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

Test a dictionary against a Value for equality

impl PartialEq<Value> for Value[src]

impl PartialOrd<Value> for Value[src]

impl<'_> PrettyDebug for &'_ Value[src]

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

Get a borrowed Value ready to be pretty-printed

impl PrettyDebug for Value[src]

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

Get a Value ready to be pretty-printed

impl Serialize for Value[src]

impl ShellTypeName for Value[src]

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

Get the type name for the Value

impl StructuralEq for Value[src]

impl<'_> TryFrom<&'_ Value> for i64[src]

type Error = ShellError

The type returned in the event of a conversion error.

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

Convert to an i64 integer, if possible

impl<'_> TryFrom<&'_ Value> for String[src]

type Error = ShellError

The type returned in the event of a conversion error.

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

Convert to a string, if possible

impl<'_> TryFrom<&'_ Value> for Vec<u8>[src]

type Error = ShellError

The type returned in the event of a conversion error.

fn try_from(value: &Value) -> Result<Vec<u8>, ShellError>[src]

Convert to a u8 vec, if possible

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

type Error = ShellError

The type returned in the event of a conversion error.

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

Convert to a dictionary, if possible

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]

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> HasFallibleSpan for T where
    T: HasSpan
[src]

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

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

type Output = T

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, 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.