pub struct FieldSnapshot<'a> { /* private fields */ }Expand description
The metadata fields of one dictionary and their values.
Implementations§
Source§impl<'a> FieldSnapshot<'a>
impl<'a> FieldSnapshot<'a>
Sourcepub fn new(
dictionary: Option<&'a AppDataDictionary>,
catalogue: &[ApplicationComponentDefinition],
) -> Result<Self, FieldError>
pub fn new( dictionary: Option<&'a AppDataDictionary>, catalogue: &[ApplicationComponentDefinition], ) -> Result<Self, FieldError>
List the fields of dictionary’s registry, labelling each
application field with the first catalogue definition of its ID
when that definition is valid, as registration does. None is a
group without a dictionary. ComponentRegistry::iter already
skips an entry missing any of its three member policies, so every
listed field has all three.
Sourcepub fn fields(&self) -> &[MetadataFieldDescriptor]
pub fn fields(&self) -> &[MetadataFieldDescriptor]
The group’s fields in component ID order.
Sourcepub fn field(&self, name: &str) -> Option<&MetadataFieldDescriptor>
pub fn field(&self, name: &str) -> Option<&MetadataFieldDescriptor>
The listed field named name. Well-known IDs sort before
application IDs, so a well-known field wins a name clash.
Sourcepub fn registry(&self) -> &ComponentRegistry
pub fn registry(&self) -> &ComponentRegistry
The registry the fields come from.
Sourcepub fn resolve(
&self,
field: &MetadataFieldRef,
) -> Result<&MetadataFieldDescriptor, FieldError>
pub fn resolve( &self, field: &MetadataFieldRef, ) -> Result<&MetadataFieldDescriptor, FieldError>
The listed field with field’s ID; its name is ignored.
Sourcepub fn value(
&self,
field: &MetadataFieldRef,
) -> Result<Option<MetadataValue>, FieldError>
pub fn value( &self, field: &MetadataFieldRef, ) -> Result<Option<MetadataValue>, FieldError>
The value of field, None when absent.
Sourcepub fn values(
&self,
fields: &[MetadataFieldRef],
) -> Result<Vec<MetadataFieldValue>, FieldError>
pub fn values( &self, fields: &[MetadataFieldRef], ) -> Result<Vec<MetadataFieldValue>, FieldError>
The values of fields, in request order. Each record carries the
listed ref, whatever name the request used.
Sourcepub fn map_value(
&self,
field: &MetadataFieldRef,
key: &FieldKey,
) -> Result<Option<FieldValue>, FieldError>
pub fn map_value( &self, field: &MetadataFieldRef, key: &FieldKey, ) -> Result<Option<FieldValue>, FieldError>
The value under key of the map field.
Sourcepub fn user_data(
&self,
fields: Option<&[MetadataFieldRef]>,
inbox_ids: Option<&[InboxId]>,
) -> Result<BTreeMap<InboxId, Vec<UserFieldValue>>, FieldError>
pub fn user_data( &self, fields: Option<&[MetadataFieldRef]>, inbox_ids: Option<&[InboxId]>, ) -> Result<BTreeMap<InboxId, Vec<UserFieldValue>>, FieldError>
Per-inbox values of user fields. fields = None selects every user
field in ID order; inbox_ids = None selects the DM_MEMBERS pair
when present (only a DM holds it) and the
GROUP_MEMBERSHIP inboxes otherwise. Every selected inbox has an
entry, empty when it holds no selected value. A field whose value
does not decode under its committed type contributes no values; a
field named twice is refused.
Sourcepub fn field_write(
&self,
field: &MetadataFieldRef,
mutation: &ComponentMutation,
) -> Result<FieldWrite, FieldError>
pub fn field_write( &self, field: &MetadataFieldRef, mutation: &ComponentMutation, ) -> Result<FieldWrite, FieldError>
Encode mutation of field under the field’s committed type.
Sourcepub fn user_data_writes(
&self,
values: &[UserFieldUpdate],
) -> Result<Vec<FieldWrite>, FieldError>
pub fn user_data_writes( &self, values: &[UserFieldUpdate], ) -> Result<Vec<FieldWrite>, FieldError>
Encode the writer’s own-key sets and clears of user fields.
Sourcepub fn resolve_writes(
&self,
values: Option<&AppDataDictionary>,
own: InboxId,
writes: &[FieldWrite],
) -> Result<Vec<(ComponentId, AppDataUpdateOperation)>, FieldError>
pub fn resolve_writes( &self, values: Option<&AppDataDictionary>, own: InboxId, writes: &[FieldWrite], ) -> Result<Vec<(ComponentId, AppDataUpdateOperation)>, FieldError>
The AppDataUpdate operations that carry out writes for the
inbox own, given the current component values in values: this
snapshot’s dictionary with any pending updates applied.
Types and the field list come from this snapshot, which must be the committed one. Each write is refused if its field is gone or changed type. Every payload is applied to its current value, so bounds, UTF-8, and key presence fail here rather than in the commit. A write that changes nothing is dropped: a clear of an absent key, a removal of an absent component, or an update whose result equals the current bytes.
Sourcepub fn write_operations(
&self,
values: Option<&AppDataDictionary>,
own: InboxId,
writes: &[FieldWrite],
) -> Result<Vec<(ComponentId, AppDataUpdateOperation)>, FieldError>
pub fn write_operations( &self, values: Option<&AppDataDictionary>, own: InboxId, writes: &[FieldWrite], ) -> Result<Vec<(ComponentId, AppDataUpdateOperation)>, FieldError>
The operations of writes as Self::resolve_writes gives them,
keeping an update whose result equals the current bytes: the
operations a receiver would check if they were published.
Auto Trait Implementations§
impl<'a> Freeze for FieldSnapshot<'a>
impl<'a> RefUnwindSafe for FieldSnapshot<'a>
impl<'a> Send for FieldSnapshot<'a>
impl<'a> Sync for FieldSnapshot<'a>
impl<'a> Unpin for FieldSnapshot<'a>
impl<'a> UnsafeUnpin for FieldSnapshot<'a>
impl<'a> UnwindSafe for FieldSnapshot<'a>
Blanket Implementations§
§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read more§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read more§fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoSql for T
impl<T> IntoSql for T
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].