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]
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
fn from_str(s: &str) -> Result<Json, Error>
Construct a Json object by parsing a string
fn from_reader<R: Read>(r: R) -> Result<Json, Error>
Construct a Json object from a reader
fn from_serialize<T: Serialize>(t: &T) -> Result<Json, Error>
Construct a Json object from a Serialize type
fn null(&self) -> Option<()>
Returns a null, if this is a null
fn bool(&self) -> Option<bool>
Returns the value, if this is a boolean
fn num(&self) -> Option<&str>
Returns the value, if this is a number
fn string(&self) -> Option<&str>
Returns the value, if this is a string
fn array(&self) -> Option<&[Json]>
Returns the value, if this is an array
fn object(&self) -> Option<&[(String, Json)]>
Returns the value, if this is an object
fn get(&self, index: &str) -> Option<&Json>
Obtain a reference to a specified member, if this is an object
fn len(&self) -> usize
Return the number of subobjects this object represents (so a count for Arrays and Objects). NOT a string length.
fn is_empty(&self) -> bool
Return whether the object is empty, if it is a collection
fn write_to<W: Write>(&self, w: W) -> Result<()>
Reserialize the object into a writer
fn to_bytes(&self) -> Vec<u8>
Reserialize the object to byte array
fn into_deserialize<T: Deserialize>(self) -> Result<T, Error>
Convert the Json object to something deserializable
Trait Implementations
impl Deserialize for Json
[src]
fn deserialize<D: Deserializer>(d: &mut D) -> Result<Json, D::Error>
Deserialize this value given this Deserializer
.
impl Serialize for Json
[src]
fn serialize<S: Serializer>(&self, s: &mut S) -> Result<(), S::Error>
Serializes this value into this serializer.
impl Debug for Json
[src]
impl Eq for Json
[src]
impl PartialEq for Json
[src]
fn eq(&self, __arg_0: &Json) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Json) -> bool
This method tests for !=
.
impl Clone for Json
[src]
fn clone(&self) -> Json
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl From<()> for Json
[src]
impl From<bool> for Json
[src]
impl From<usize> for Json
[src]
impl From<u64> for Json
[src]
impl From<u32> for Json
[src]
impl From<u16> for Json
[src]
impl From<u8> for Json
[src]
impl From<isize> for Json
[src]
impl From<i64> for Json
[src]
impl From<i32> for Json
[src]
impl From<i16> for Json
[src]
impl From<i8> for Json
[src]
impl From<f64> for Json
[src]
impl From<f32> for Json
[src]
impl From<String> for Json
[src]
impl<'a> From<&'a str> for Json
[src]
impl From<Vec<Json>> for Json
[src]
impl From<Vec<(String, Json)>> for Json
[src]
impl<'a> Index<&'a str> for Json
[src]
type Output = Json
The returned type after indexing
fn index(&self, index: &'a str) -> &Json
The method for the indexing (Foo[Bar]
) operation
impl Index<usize> for Json
[src]
type Output = Json
The returned type after indexing
fn index(&self, index: usize) -> &Json
The method for the indexing (Foo[Bar]
) operation
impl Index<Range<usize>> for Json
[src]
type Output = [Json]
The returned type after indexing
fn index(&self, index: Range<usize>) -> &[Json]
The method for the indexing (Foo[Bar]
) operation
impl Index<RangeTo<usize>> for Json
[src]
type Output = [Json]
The returned type after indexing
fn index(&self, index: RangeTo<usize>) -> &[Json]
The method for the indexing (Foo[Bar]
) operation
impl Index<RangeFrom<usize>> for Json
[src]
type Output = [Json]
The returned type after indexing
fn index(&self, index: RangeFrom<usize>) -> &[Json]
The method for the indexing (Foo[Bar]
) operation