Struct strason::Json [−][src]
pub struct Json(_);
A "stringly-typed" Json object. That is, either a value (represented as a String), or an object (represented as a map from Strings to Jsons).
Methods
impl Json
[src]
impl Json
pub fn from_iter<I: Iterator<Item = Result<u8>>>(it: I) -> Result<Json, Error>
[src]
pub fn from_iter<I: Iterator<Item = Result<u8>>>(it: I) -> Result<Json, Error>
Construct a Json object by parsing a byte iterator, e.g. from a Reader
pub fn from_str(s: &str) -> Result<Json, Error>
[src]
pub fn from_str(s: &str) -> Result<Json, Error>
Construct a Json object by parsing a string
pub fn from_reader<R: Read>(r: R) -> Result<Json, Error>
[src]
pub fn from_reader<R: Read>(r: R) -> Result<Json, Error>
Construct a Json object from a reader
pub fn from_serialize<T: Serialize>(val: T) -> Result<Json, Error>
[src]
pub fn from_serialize<T: Serialize>(val: T) -> Result<Json, Error>
Converts something serializable to a Json object
pub fn null(&self) -> Option<()>
[src]
pub fn null(&self) -> Option<()>
Returns a null, if this is a null
pub fn bool(&self) -> Option<bool>
[src]
pub fn bool(&self) -> Option<bool>
Returns the value, if this is a boolean
pub fn num(&self) -> Option<&str>
[src]
pub fn num(&self) -> Option<&str>
Returns the value, if this is a number
pub fn string(&self) -> Option<&str>
[src]
pub fn string(&self) -> Option<&str>
Returns the value, if this is a string
pub fn array(&self) -> Option<&[Json]>
[src]
pub fn array(&self) -> Option<&[Json]>
Returns the value, if this is an array
pub fn object(&self) -> Option<&[(String, Json)]>
[src]
pub fn object(&self) -> Option<&[(String, Json)]>
Returns the value, if this is an object
pub fn get(&self, index: &str) -> Option<&Json>
[src]
pub fn get(&self, index: &str) -> Option<&Json>
Obtain a reference to a specified member, if this is an object
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Return the number of subobjects this object represents (so a count for Arrays and Objects). NOT a string length.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Return whether the object is empty, if it is a collection
pub fn write_to<W: Write>(&self, w: W) -> Result<()>
[src]
pub fn write_to<W: Write>(&self, w: W) -> Result<()>
Reserialize the object into a writer
pub fn to_bytes(&self) -> Vec<u8>
[src]
pub fn to_bytes(&self) -> Vec<u8>
Serialize the object to byte array
pub fn into_deserialize<'a, T: Deserialize<'a>>(self) -> Result<T, Error>
[src]
pub fn into_deserialize<'a, T: Deserialize<'a>>(self) -> Result<T, Error>
Convert the Json object to something deserializable
Trait Implementations
impl<'de> Deserialize<'de> for Json
[src]
impl<'de> Deserialize<'de> for Json
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Json, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Json, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Serialize for Json
[src]
impl Serialize for Json
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
[src]
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
Serialize this value into the given Serde serializer. Read more
impl Clone for Json
[src]
impl Clone for Json
fn clone(&self) -> Json
[src]
fn clone(&self) -> Json
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for Json
[src]
impl PartialEq for Json
fn eq(&self, other: &Json) -> bool
[src]
fn eq(&self, other: &Json) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Json) -> bool
[src]
fn ne(&self, other: &Json) -> bool
This method tests for !=
.
impl Eq for Json
[src]
impl Eq for Json
impl Debug for Json
[src]
impl Debug for Json
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl From<()> for Json
[src]
impl From<()> for Json
impl From<bool> for Json
[src]
impl From<bool> for Json
impl From<usize> for Json
[src]
impl From<usize> for Json
impl From<u64> for Json
[src]
impl From<u64> for Json
impl From<u32> for Json
[src]
impl From<u32> for Json
impl From<u16> for Json
[src]
impl From<u16> for Json
impl From<u8> for Json
[src]
impl From<u8> for Json
impl From<isize> for Json
[src]
impl From<isize> for Json
impl From<i64> for Json
[src]
impl From<i64> for Json
impl From<i32> for Json
[src]
impl From<i32> for Json
impl From<i16> for Json
[src]
impl From<i16> for Json
impl From<i8> for Json
[src]
impl From<i8> for Json
impl From<f64> for Json
[src]
impl From<f64> for Json
impl From<f32> for Json
[src]
impl From<f32> for Json
impl From<String> for Json
[src]
impl From<String> for Json
impl<'a> From<&'a str> for Json
[src]
impl<'a> From<&'a str> for Json
impl From<Vec<Json>> for Json
[src]
impl From<Vec<Json>> for Json
impl From<Vec<(String, Json)>> for Json
[src]
impl From<Vec<(String, Json)>> for Json
impl Display for Json
[src]
impl Display for Json
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> Index<&'a str> for Json
[src]
impl<'a> Index<&'a str> for Json
type Output = Json
The returned type after indexing.
fn index(&self, index: &'a str) -> &Json
[src]
fn index(&self, index: &'a str) -> &Json
Performs the indexing (container[index]
) operation.
impl Index<usize> for Json
[src]
impl Index<usize> for Json
type Output = Json
The returned type after indexing.
fn index(&self, index: usize) -> &Json
[src]
fn index(&self, index: usize) -> &Json
Performs the indexing (container[index]
) operation.
impl Index<Range<usize>> for Json
[src]
impl Index<Range<usize>> for Json
type Output = [Json]
The returned type after indexing.
fn index(&self, index: Range<usize>) -> &[Json]
[src]
fn index(&self, index: Range<usize>) -> &[Json]
Performs the indexing (container[index]
) operation.
impl Index<RangeTo<usize>> for Json
[src]
impl Index<RangeTo<usize>> for Json
type Output = [Json]
The returned type after indexing.
fn index(&self, index: RangeTo<usize>) -> &[Json]
[src]
fn index(&self, index: RangeTo<usize>) -> &[Json]
Performs the indexing (container[index]
) operation.
impl Index<RangeFrom<usize>> for Json
[src]
impl Index<RangeFrom<usize>> for Json
type Output = [Json]
The returned type after indexing.
fn index(&self, index: RangeFrom<usize>) -> &[Json]
[src]
fn index(&self, index: RangeFrom<usize>) -> &[Json]
Performs the indexing (container[index]
) operation.
impl Index<RangeFull> for Json
[src]
impl Index<RangeFull> for Json