pub struct Addressing<'a> {
pub keyed_lists: &'a [KeyedList<'a>],
pub array_rule: Option<ArrayRule<'a>>,
}Expand description
How a non-numeric path segment resolves against an array.
A non-empty ASCII-decimal segment is always an index and never consults this (overflow is an error, not a slug fallback). Everything else has two possible sources, tried in this order:
keyed_lists— the caller’s own declarations, e.g. “the array atidentitiesis keyed by each element’sidentityfield”. A JSON or TOML document does not say this about itself, so only the caller can, and it names one exact array by path.array_rule— the format’s rule, for a format whose value is a tree afdata synthesized and therefore knows the shape of. Only Markdown has one today; it applies to every array in the document rather than to one named path.
With neither, a non-numeric segment against an array is
DocumentError::UnregisteredArray
— afdata will not scan an array it was told nothing about.
Fields§
§keyed_lists: &'a [KeyedList<'a>]§array_rule: Option<ArrayRule<'a>>Implementations§
Source§impl<'a> Addressing<'a>
impl<'a> Addressing<'a>
Sourcepub const INDEX_ONLY: Addressing<'static>
pub const INDEX_ONLY: Addressing<'static>
Indices only: no keyed lists, no format rule.
Sourcepub const fn keyed(keyed_lists: &'a [KeyedList<'a>]) -> Self
pub const fn keyed(keyed_lists: &'a [KeyedList<'a>]) -> Self
Caller-declared keyed lists, with no format rule.
Sourcepub const fn with_array_rule(self, array_rule: Option<ArrayRule<'a>>) -> Self
pub const fn with_array_rule(self, array_rule: Option<ArrayRule<'a>>) -> Self
The same addressing plus a format’s built-in array rule.
Trait Implementations§
Source§impl<'a> Clone for Addressing<'a>
impl<'a> Clone for Addressing<'a>
Source§fn clone(&self) -> Addressing<'a>
fn clone(&self) -> Addressing<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for Addressing<'a>
Source§impl<'a> Debug for Addressing<'a>
impl<'a> Debug for Addressing<'a>
Source§impl<'a> Default for Addressing<'a>
impl<'a> Default for Addressing<'a>
Source§fn default() -> Addressing<'a>
fn default() -> Addressing<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for Addressing<'a>
impl<'a> RefUnwindSafe for Addressing<'a>
impl<'a> Send for Addressing<'a>
impl<'a> Sync for Addressing<'a>
impl<'a> Unpin for Addressing<'a>
impl<'a> UnsafeUnpin for Addressing<'a>
impl<'a> UnwindSafe for Addressing<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more