pub enum Val {
Null,
Bool(bool),
Num(Num),
Str(Bytes, Tag),
Arr(Rc<Vec<Val>>),
Obj(Rc<Map<Val, Val>>),
}Expand description
JSON superset with binary data and non-string object keys.
This is the default value type for jaq.
Variants§
Null
Null
Bool(bool)
Boolean
Num(Num)
Number
Str(Bytes, Tag)
String
Arr(Rc<Vec<Val>>)
Array
Obj(Rc<Map<Val, Val>>)
Object
Implementations§
Trait Implementations§
Source§impl FromIterator<Val> for Val
impl FromIterator<Val> for Val
Source§fn from_iter<T: IntoIterator<Item = Self>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl Ord for Val
impl Ord for Val
Source§impl PartialOrd for Val
impl PartialOrd for Val
Source§impl ValT for Val
impl ValT for Val
Source§fn from_map<I: IntoIterator<Item = (Self, Self)>>(iter: I) -> ValR
fn from_map<I: IntoIterator<Item = (Self, Self)>>(iter: I) -> ValR
Create an associative map (or object) from a sequence of key-value pairs. Read more
Source§fn key_values(self) -> Box<dyn Iterator<Item = Result<(Val, Val), Error>>>
fn key_values(self) -> Box<dyn Iterator<Item = Result<(Val, Val), Error>>>
Yield the key-value pairs of a value. Read more
Source§fn range(self, range: Range<&Self>) -> ValR
fn range(self, range: Range<&Self>) -> ValR
Yield a slice of the value with the given range. Read more
Source§fn map_values<I: Iterator<Item = ValX>>(
self,
opt: Opt,
f: impl Fn(Self) -> I,
) -> ValX
fn map_values<I: Iterator<Item = ValX>>( self, opt: Opt, f: impl Fn(Self) -> I, ) -> ValX
Map a function over the children of the value. Read more
Source§fn map_index<I: Iterator<Item = ValX>>(
self,
index: &Self,
opt: Opt,
f: impl Fn(Self) -> I,
) -> ValX
fn map_index<I: Iterator<Item = ValX>>( self, index: &Self, opt: Opt, f: impl Fn(Self) -> I, ) -> ValX
Map a function over the child of the value at the given index. Read more
Source§fn map_range<I: Iterator<Item = ValX>>(
self,
range: Range<&Self>,
opt: Opt,
f: impl Fn(Self) -> I,
) -> ValX
fn map_range<I: Iterator<Item = ValX>>( self, range: Range<&Self>, opt: Opt, f: impl Fn(Self) -> I, ) -> ValX
Map a function over the slice of the value with the given range. Read more
Source§fn into_string(self) -> Self
fn into_string(self) -> Self
Convert value into a string value. Read more
Source§impl ValT for Val
impl ValT for Val
Source§fn into_seq<S: FromIterator<Self>>(self) -> Result<S, Self>
fn into_seq<S: FromIterator<Self>>(self) -> Result<S, Self>
Convert an array into a sequence. Read more
Source§fn is_utf8_str(&self) -> bool
fn is_utf8_str(&self) -> bool
True if the value is interpreted as UTF-8 string.
Source§fn as_bytes(&self) -> Option<&[u8]>
fn as_bytes(&self) -> Option<&[u8]>
If the value is a string (whatever its interpretation), return its bytes.
Source§fn as_sub_str(&self, sub: &[u8]) -> Self
fn as_sub_str(&self, sub: &[u8]) -> Self
If the value is a string and
sub points to a slice of the string,
shorten the string to sub, else panic.Source§fn from_utf8_bytes(b: impl AsRef<[u8]> + Send + 'static) -> Self
fn from_utf8_bytes(b: impl AsRef<[u8]> + Send + 'static) -> Self
Interpret bytes as UTF-8 string value.
Source§fn as_utf8_bytes(&self) -> Option<&[u8]>
fn as_utf8_bytes(&self) -> Option<&[u8]>
If the value is interpreted as UTF-8 string, return its bytes.
impl Eq for Val
Auto Trait Implementations§
impl !Freeze for Val
impl RefUnwindSafe for Val
impl !Send for Val
impl !Sync for Val
impl Unpin for Val
impl UnwindSafe for Val
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.