Skip to main content

Aggregate

Struct Aggregate 

Source
pub struct Aggregate<V> { /* private fields */ }
Expand description

An aggregate under construction.

The read direction does not build a structure in one go: a @mutable type is driven by the headers the writer wrote, in whatever order it wrote them, and the members the stream left out take their defaults afterwards. So the value is assembled by name, and the two things the assembly has to answer are whether a member is already in — §7.4.1.2.3’s defaulting asks it — and whether one arrived twice, which is a stream this type does not describe.

Insertion order is preserved and a repeat replaces in place, which is serde_json::Map::insert’s contract and the one the two @mutable readers were written against.

Implementations§

Source§

impl<V> Aggregate<V>

Source

pub const fn new() -> Self

A fresh, empty aggregate.

Source

pub fn contains(&self, name: &str) -> bool

Whether a member of this name is already in.

Source

pub fn insert(&mut self, name: String, value: V) -> Option<V>

Put a member in, answering with the one it replaced.

Some is what says a stream carried the same member twice.

Source

pub fn into_entries(self) -> Vec<(String, V)>

The members, in the order they went in.

Trait Implementations§

Source§

impl<V> Default for Aggregate<V>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<V> Freeze for Aggregate<V>
where Vec<(String, V)>: Freeze,

§

impl<V> RefUnwindSafe for Aggregate<V>
where Vec<(String, V)>: RefUnwindSafe,

§

impl<V> Send for Aggregate<V>
where Vec<(String, V)>: Send,

§

impl<V> Sync for Aggregate<V>
where Vec<(String, V)>: Sync,

§

impl<V> Unpin for Aggregate<V>
where Vec<(String, V)>: Unpin,

§

impl<V> UnsafeUnpin for Aggregate<V>
where Vec<(String, V)>: UnsafeUnpin,

§

impl<V> UnwindSafe for Aggregate<V>
where Vec<(String, V)>: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.