[][src]Type Definition json_spanned_value::spanned::Value

type Value = Spanned<Value>;

Owned, arbitrary json value + span information

Implementations

impl Value[src]

Various conversion methods:

  • as_span_[type]() returns borrowing Options of some sort.
  • into_span_[type]() returns Ok(type) or Err(original).

See also on super::Value as provided by Deref implementation:

  • is_[type]() returns bools with obvious meanings.
  • as_[type]() for borrowing Options without span info.
  • into_[type]() for Ok(type) without span info, or Err(original).

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

Some(span + ()) if self is null`

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

Some(span + inner) if self is true or false

pub fn as_span_number(&self) -> Option<Num<'_>>[src]

Some(span + &inner) if self is a number like 123

pub fn as_span_string(&self) -> Option<Str<'_>>[src]

Some(span + &inner) if self is a string like "asdf"

pub fn as_span_array(&self) -> Option<Span<'_>>[src]

Some(span + &inner) if self is an array like [1, 2, 3]

pub fn as_span_object(&self) -> Option<Obj<'_>>[src]

Some(span + &inner) if self is an object like {"a": 1, "b": 2}

pub fn into_span_null(self) -> Result<Null, Self>[src]

Ok(span + ()) if self is null, otherwise Err(self)

pub fn into_span_bool(self) -> Result<Bool, Self>[src]

Ok(span + inner) if self is true or false, otherwise Err(self)

pub fn into_span_number(self) -> Result<Number, Self>[src]

Ok(span + inner) if self is a number like 123, otherwise Err(self)

pub fn into_span_string(self) -> Result<String, Self>[src]

Ok(span + inner) if self is a string like "asdf", otherwise Err(self)

pub fn into_span_array(self) -> Result<Array, Self>[src]

Ok(span + inner) if self is an array like [1, 2, 3], otherwise Err(self)

pub fn into_span_object(self) -> Result<Object, Self>[src]

Ok(span + inner) if self is an object like {"a": 1, "b": 2}, otherwise Err(self)

pub fn pointer(&self, path: &str) -> Option<&Value>[src]

Lookup a value by JSON Pointer (RFC 6901)

pub fn pointer_mut(&mut self, path: &str) -> Option<&mut Value>[src]

Lookup a value by JSON Pointer (RFC 6901)