Enum nop_json::Value [−][src]
Type to store any JSON node.
Numbers are represented by 3 parts: mantissa, exponent, sign.
Many built-in types can be converted to Value
.
use nop_json::Value; use std::convert::TryInto; let v0: Value = 3u32.try_into().unwrap(); let v1: Value = vec![true, false, true].try_into().unwrap(); assert_eq!(v0, Value::Number(3, 0, false)); assert_eq!(v1, Value::Array(vec![Value::Bool(true), Value::Bool(false), Value::Bool(true)]));
And the Value
can be converted to many types.
use nop_json::Value; use std::convert::TryInto; let v0: u32 = Value::Number(3, 0, false).try_into().unwrap(); let v1: Vec<bool> = Value::Array(vec![Value::Bool(true), Value::Bool(false), Value::Bool(true)]).try_into().unwrap(); assert_eq!(v0, 3u32); assert_eq!(v1, vec![true, false, true]);
Variants
Bool(bool)
String(String)
Implementations
impl Value
[src]
pub fn is_null(&self) -> bool
[src]
pub fn is_bool(&self) -> bool
[src]
pub fn is_number(&self) -> bool
[src]
pub fn is_string(&self) -> bool
[src]
pub fn is_array(&self) -> bool
[src]
pub fn is_object(&self) -> bool
[src]
Trait Implementations
impl Clone for Value
[src]
impl Debug for Value
[src]
impl DebugToJson for Value
[src]
fn fmt(&self, out: &mut Formatter<'_>) -> Result
[src]
fn to_json_string(&self) -> String where
Self: Sized,
[src]
Self: Sized,
impl Display for Value
[src]
impl FromStr for Value
[src]
type Err = ()
The associated error which can be returned from parsing.
fn from_str(value: &str) -> Result<Self, Self::Err>
[src]
impl<'a> Index<&'a str> for Value
[src]
type Output = Value
The returned type after indexing.
fn index(&self, index: &'a str) -> &Self::Output
[src]
impl PartialEq<Value> for Value
[src]
impl StructuralPartialEq for Value
[src]
impl TryFrom<()> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(_value: ()) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, ()>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, ()>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, String>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, String>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, bool>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, bool>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, char>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, char>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, i16>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, i16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, i32>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, i32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, i64>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, i64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, i8>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, i8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, isize>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, isize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, u16>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, u16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, u32>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, u32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, u64>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, u64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, u8>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, u8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<BTreeMap<String, usize>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: BTreeMap<String, usize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, (), RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, ()>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, String, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, String>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, Value, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, Value>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, bool, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, bool>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, char, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, char>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, i16, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, i16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, i32, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, i32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, i64, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, i64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, i8, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, i8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, isize, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, isize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, u16, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, u16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, u32, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, u32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, u64, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, u64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, u8, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, u8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<HashMap<String, usize, RandomState>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: HashMap<String, usize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<()>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<()>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<String>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<String>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<bool>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<bool>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<char>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<char>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<i16>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<i16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<i32>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<i32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<i64>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<i64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<i8>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<i8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<isize>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<isize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<u16>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<u16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<u32>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<u32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<u64>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<u64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<u8>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<u8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<LinkedList<usize>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: LinkedList<usize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<String> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: String) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<(), Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<()>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<String, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<String>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<Value, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<Value>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<bool, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<bool>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<char, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<char>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<i16, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<i16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<i32, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<i32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<i64, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<i64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<i8, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<i8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<isize, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<isize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<u16, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<u16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<u32, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<u32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<u64, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<u64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<u8, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<u8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<usize, Global>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: Vec<usize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<()>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<()>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<String>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<String>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<bool>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<bool>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<char>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<char>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<i16>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<i16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<i32>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<i32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<i64>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<i64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<i8>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<i8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<isize>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<isize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<u16>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<u16>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<u32>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<u32>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<u64>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<u64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<u8>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<u8>) -> Result<Self, Self::Error>
[src]
impl TryFrom<VecDeque<usize>> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: VecDeque<usize>) -> Result<Self, Self::Error>
[src]
impl TryFrom<bool> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: bool) -> Result<Self, Self::Error>
[src]
impl TryFrom<char> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: char) -> Result<Self, Self::Error>
[src]
impl TryFrom<i16> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: i16) -> Result<Self, Self::Error>
[src]
impl TryFrom<i32> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: i32) -> Result<Self, Self::Error>
[src]
impl TryFrom<i64> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: i64) -> Result<Self, Self::Error>
[src]
impl TryFrom<i8> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: i8) -> Result<Self, Self::Error>
[src]
impl TryFrom<isize> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: isize) -> Result<Self, Self::Error>
[src]
impl TryFrom<u16> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: u16) -> Result<Self, Self::Error>
[src]
impl TryFrom<u32> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: u32) -> Result<Self, Self::Error>
[src]
impl TryFrom<u64> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: u64) -> Result<Self, Self::Error>
[src]
impl TryFrom<u8> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: u8) -> Result<Self, Self::Error>
[src]
impl TryFrom<usize> for Value
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: usize) -> Result<Self, Self::Error>
[src]
impl TryFromJson for Value
[src]
impl<W: Write> WriteToJson<W> for Value
[src]
fn write_to_json(&self, out: &mut W) -> Result<()>
[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]
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,