pub struct Policy {
pub invalid: Action,
pub vocab: Action,
pub allow_undefined: bool,
}Expand description
Key expansion policy.
By default the expansion algorithm drops the keys that are not defined in the active context, unless:
- the active context defines a vocabulary mapping (
@vocab); or - the key contains a
:character, in which case it is kept as it is, even though it may not be a well-formed IRI.
Silently dropping data is not always what an application wants: a stricter
setting turns each of those situations into an error instead. Set the
wanted policy through the Options::policy field.
Fields§
§invalid: ActionWhat to do with a key that expands to a malformed IRI.
Action::Keep (the default) keeps it in the expanded document,
Action::Drop drops the entry, and Action::Reject aborts
expansion with Error::KeyExpansionFailed — or, for a value of
@type, Error::InvalidTypeValue.
vocab: ActionWhat to do with a key that only expands because the active context
defines a vocabulary mapping (@vocab).
Action::Keep (the default) expands it against the vocabulary
mapping, Action::Drop drops the entry, and Action::Reject
aborts expansion with Error::ForbiddenVocab.
allow_undefined: boolWhether a key that neither the active context nor a vocabulary mapping can expand may be dropped.
true by default. Set it to false to abort expansion with
Error::KeyExpansionFailed instead of losing the entry.
Trait Implementations§
impl Copy for Policy
impl Eq for Policy
impl StructuralPartialEq for Policy
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnsafeUnpin for Policy
impl UnwindSafe for Policy
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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self is equivalent to key.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.