Struct juniper::Object

source ·
pub struct Object<S> { /* private fields */ }
Expand description

A Object value

Implementations§

source§

impl<S> Object<S>

source

pub fn with_capacity(size: usize) -> Self

Create a new Object value with a fixed number of preallocated slots for field-value pairs

source

pub fn add_field<K>(&mut self, k: K, value: Value<S>) -> Option<Value<S>>where
    K: AsRef<str> + Into<String>,

Add a new field with a value

If there is already a field for the given key any both values are objects, they are merged.

Otherwise the existing value is replaced and returned.

source

pub fn contains_field<K: AsRef<str>>(&self, k: K) -> bool

Check if the object already contains a field with the given name

source

pub fn iter(&self) -> impl Iterator<Item = (&String, &Value<S>)>

Get a iterator over all field value pairs

source

pub fn iter_mut(&mut self) -> impl Iterator<Item = (&String, &mut Value<S>)>

Get a iterator over all mutable field value pairs

source

pub fn field_count(&self) -> usize

Get the current number of fields

source

pub fn get_field_value<K: AsRef<str>>(&self, key: K) -> Option<&Value<S>>

Get the value for a given field

source

pub fn get_mut_field_value<K: AsRef<str>>(
    &mut self,
    key: K
) -> Option<&mut Value<S>>

Get the mutable value for a given field

Trait Implementations§

source§

impl<S: Clone> Clone for Object<S>

source§

fn clone(&self) -> Object<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: Debug> Debug for Object<S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S> From<Object<S>> for Value<S>

source§

fn from(o: Object<S>) -> Self

Converts to this type from the input type.
source§

impl<K, S> FromIterator<(K, Value<S>)> for Object<S>where
    K: AsRef<str> + Into<String>,

source§

fn from_iter<I>(iter: I) -> Selfwhere
    I: IntoIterator<Item = (K, Value<S>)>,

Creates a value from an iterator. Read more
source§

impl<S> IntoIterator for Object<S>

§

type Item = (String, Value<S>)

The type of the elements being iterated over.
§

type IntoIter = IntoIter<String, Value<S>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<S: PartialEq> PartialEq<Object<S>> for Object<S>

source§

fn eq(&self, other: &Object<S>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Serialize for Object<T>where
    T: Serialize,

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where
    S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<S> StructuralPartialEq for Object<S>

Auto Trait Implementations§

§

impl<S> RefUnwindSafe for Object<S>where
    S: RefUnwindSafe,

§

impl<S> Send for Object<S>where
    S: Send,

§

impl<S> Sync for Object<S>where
    S: Sync,

§

impl<S> Unpin for Object<S>where
    S: Unpin,

§

impl<S> UnwindSafe for Object<S>where
    S: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere
    T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere
    V: MultiLane<T>,

§

fn vzip(self) -> V