Struct jsonc_parser::ast::Object[][src]

pub struct Object<'a> {
    pub range: Range,
    pub properties: Vec<ObjectProp<'a>>,
}

Represents an object that may contain properties (ex. {}, { "prop": 4 }).

Fields

range: Rangeproperties: Vec<ObjectProp<'a>>

Implementations

impl<'a> Object<'a>[src]

pub fn get(&self, name: &str) -> Option<&ObjectProp<'_>>[src]

Gets a property value in the object by its name.

pub fn get_string(&self, name: &str) -> Option<&StringLit<'_>>[src]

Gets a string property value from the object by name. Returns None when not a string or it doesn’t exist.

pub fn get_number(&self, name: &str) -> Option<&NumberLit<'_>>[src]

Gets a number property value from the object by name. Returns None when not a number or it doesn’t exist.

pub fn get_boolean(&self, name: &str) -> Option<&BooleanLit>[src]

Gets a boolean property value from the object by name. Returns None when not a boolean or it doesn’t exist.

pub fn get_object(&self, name: &str) -> Option<&Object<'_>>[src]

Gets an object property value from the object by name. Returns None when not an object or it doesn’t exist.

pub fn get_array(&self, name: &str) -> Option<&Array<'_>>[src]

Gets an array property value from the object by name. Returns None when not an array or it doesn’t exist.

pub fn take(&mut self, name: &str) -> Option<ObjectProp<'_>>[src]

Takes a value from the object by name. Returns None when it doesn’t exist.

pub fn take_string(&mut self, name: &str) -> Option<StringLit<'_>>[src]

Takes a string property value from the object by name. Returns None when not a string or it doesn’t exist.

pub fn take_number(&mut self, name: &str) -> Option<NumberLit<'_>>[src]

Takes a number property value from the object by name. Returns None when not a number or it doesn’t exist.

pub fn take_boolean(&mut self, name: &str) -> Option<BooleanLit>[src]

Takes a boolean property value from the object by name. Returns None when not a boolean or it doesn’t exist.

pub fn take_object(&mut self, name: &str) -> Option<Object<'_>>[src]

Takes an object property value from the object by name. Returns None when not an object or it doesn’t exist.

pub fn take_array(&mut self, name: &str) -> Option<Array<'_>>[src]

Takes an array property value from the object by name. Returns None when not an array or it doesn’t exist.

Trait Implementations

impl<'a> Clone for Object<'a>[src]

impl<'a> Debug for Object<'a>[src]

impl<'a, 'b> From<&'b Object<'a>> for Node<'a, 'b>[src]

impl<'a> PartialEq<Object<'a>> for Object<'a>[src]

impl<'a> Ranged for Object<'a>[src]

impl<'a> StructuralPartialEq for Object<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Object<'a>

impl<'a> Send for Object<'a>

impl<'a> Sync for Object<'a>

impl<'a> Unpin for Object<'a>

impl<'a> UnwindSafe for Object<'a>

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.