[][src]Struct strason::Json

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]

pub fn from_iter<I: Iterator<Item = Result<u8>>>(it: I) -> Result<Json, Error>[src]

Construct a Json object by parsing a byte iterator, e.g. from a Reader

pub fn from_str(s: &str) -> Result<Json, Error>[src]

Construct a Json object by parsing a string

pub fn from_reader<R: Read>(r: R) -> Result<Json, Error>[src]

Construct a Json object from a reader

pub fn from_serialize<T: Serialize>(val: T) -> Result<Json, Error>[src]

Converts something serializable to a Json object

pub fn null(&self) -> Option<()>[src]

Returns a null, if this is a null

pub fn bool(&self) -> Option<bool>[src]

Returns the value, if this is a boolean

pub fn num(&self) -> Option<&str>[src]

Returns the value, if this is a number

pub fn string(&self) -> Option<&str>[src]

Returns the value, if this is a string

pub fn array(&self) -> Option<&[Json]>[src]

Returns the value, if this is an array

pub fn object(&self) -> Option<&[(String, Json)]>[src]

Returns the value, if this is an object

pub fn get(&self, index: &str) -> Option<&Json>[src]

Obtain a reference to a specified member, if this is an object

pub fn len(&self) -> usize[src]

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]

Return whether the object is empty, if it is a collection

pub fn write_to<W: Write>(&self, w: W) -> Result<()>[src]

Reserialize the object into a writer

pub fn to_bytes(&self) -> Vec<u8>[src]

Serialize the object to byte array

pub fn into_deserialize<'a, T: Deserialize<'a>>(self) -> Result<T, Error>[src]

Convert the Json object to something deserializable

Trait Implementations

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 Clone for Json[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<Json> for Json[src]

impl Eq for Json[src]

impl Display for Json[src]

impl Debug for Json[src]

impl<'a> Index<&'a str> for Json[src]

type Output = Json

The returned type after indexing.

impl Index<usize> for Json[src]

type Output = Json

The returned type after indexing.

impl Index<Range<usize>> for Json[src]

type Output = [Json]

The returned type after indexing.

impl Index<RangeTo<usize>> for Json[src]

type Output = [Json]

The returned type after indexing.

impl Index<RangeFrom<usize>> for Json[src]

type Output = [Json]

The returned type after indexing.

impl Index<RangeFull> for Json[src]

type Output = [Json]

The returned type after indexing.

impl Serialize for Json[src]

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

Auto Trait Implementations

impl Unpin for Json

impl Sync for Json

impl Send for Json

impl UnwindSafe for Json

impl RefUnwindSafe for Json

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

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.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]