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<JsonError>

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

fn from_str(s: &str) -> Result<JsonError>

Construct a Json object by parsing a string

fn from_reader<R: Read>(r: R) -> Result<JsonError>

Construct a Json object from a reader

fn from_serialize<T: Serialize>(t: &T) -> Result<JsonError>

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]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

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]

fn from(_: ()) -> Json

Performs the conversion.

impl From<bool> for Json
[src]

fn from(t: bool) -> Json

Performs the conversion.

impl From<usize> for Json
[src]

fn from(n: usize) -> Json

Performs the conversion.

impl From<u64> for Json
[src]

fn from(n: u64) -> Json

Performs the conversion.

impl From<u32> for Json
[src]

fn from(n: u32) -> Json

Performs the conversion.

impl From<u16> for Json
[src]

fn from(n: u16) -> Json

Performs the conversion.

impl From<u8> for Json
[src]

fn from(n: u8) -> Json

Performs the conversion.

impl From<isize> for Json
[src]

fn from(n: isize) -> Json

Performs the conversion.

impl From<i64> for Json
[src]

fn from(n: i64) -> Json

Performs the conversion.

impl From<i32> for Json
[src]

fn from(n: i32) -> Json

Performs the conversion.

impl From<i16> for Json
[src]

fn from(n: i16) -> Json

Performs the conversion.

impl From<i8> for Json
[src]

fn from(n: i8) -> Json

Performs the conversion.

impl From<f64> for Json
[src]

fn from(n: f64) -> Json

Performs the conversion.

impl From<f32> for Json
[src]

fn from(n: f32) -> Json

Performs the conversion.

impl From<String> for Json
[src]

fn from(s: String) -> Json

Performs the conversion.

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

fn from(s: &'a str) -> Json

Performs the conversion.

impl From<Vec<Json>> for Json
[src]

fn from(v: Vec<Json>) -> Json

Performs the conversion.

impl From<Vec<(String, Json)>> for Json
[src]

fn from(v: Vec<(String, Json)>) -> Json

Performs the conversion.

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

impl Index<RangeFull> for Json
[src]

type Output = [Json]

The returned type after indexing

fn index(&self, index: RangeFull) -> &[Json]

The method for the indexing (Foo[Bar]) operation