pub enum Container {
Show 17 variants
None,
Graph,
Id,
Index,
Language,
List,
Set,
Type,
GraphSet,
GraphId,
GraphIndex,
IdSet,
IndexSet,
LanguageSet,
SetType,
GraphIdSet,
GraphIndexSet,
}Expand description
Container mapping of a term: the combination of @container values it
was defined with.
Variants§
None
Empty container: no @container value.
Graph
@graph: the values of the term are graph objects.
Id
@id: the values of the term form an id map, keyed by node identifier.
Index
@index: the values of the term form an index map, keyed by an
arbitrary index string.
Language
@language: the values of the term form a language map, keyed by
language tag.
List
@list: the values of the term are an ordered list.
Set
@set: the values of the term are always represented as an array.
Type
@type: the values of the term form a type map, keyed by node type.
GraphSet
@graph and @set.
GraphId
@graph and @id.
GraphIndex
@graph and @index.
IdSet
@id and @set.
IndexSet
@index and @set.
LanguageSet
@language and @set.
SetType
@set and @type.
GraphIdSet
@graph, @id and @set.
GraphIndexSet
@graph, @index and @set.
Implementations§
Source§impl Container
impl Container
Sourcepub fn from_syntax(r: Nullable<&Container>) -> Result<Self, InvalidContainer>
pub fn from_syntax(r: Nullable<&Container>) -> Result<Self, InvalidContainer>
Builds a container mapping from its syntactic form.
§Errors
Returns an error when the @container value is not one of the combinations the grammar allows.
Sourcepub fn from<'a, I: IntoIterator<Item = &'a ContainerKind>>(
iter: I,
) -> Result<Container, ContainerKind>
pub fn from<'a, I: IntoIterator<Item = &'a ContainerKind>>( iter: I, ) -> Result<Container, ContainerKind>
Builds a container mapping from the @container values it combines.
§Errors
Returns the offending @container entry when the combination is not allowed by the grammar.
Sourcepub fn as_slice(&self) -> &[ContainerKind]
pub fn as_slice(&self) -> &[ContainerKind]
Returns the combined @container values as a slice.
Sourcepub fn iter(&self) -> impl Iterator<Item = &ContainerKind>
pub fn iter(&self) -> impl Iterator<Item = &ContainerKind>
Returns an iterator over the combined @container values.
Sourcepub fn contains(&self, c: ContainerKind) -> bool
pub fn contains(&self, c: ContainerKind) -> bool
Checks whether the mapping includes the given @container value.
Sourcepub fn with(&self, c: ContainerKind) -> Option<Container>
pub fn with(&self, c: ContainerKind) -> Option<Container>
Returns this mapping extended with the given @container value, or
None if the combination is not allowed by the JSON-LD grammar.
Sourcepub fn add(&mut self, c: ContainerKind) -> bool
pub fn add(&mut self, c: ContainerKind) -> bool
Adds the given @container value to the mapping in place. Returns
false (leaving the mapping unchanged) if the combination is not
allowed by the JSON-LD grammar.
Sourcepub fn into_syntax(self) -> Option<Container>
pub fn into_syntax(self) -> Option<Container>
Converts the mapping into its syntactic form: a single @container
value when it combines exactly one, an array when it combines several,
and None when it is empty.
Trait Implementations§
impl Copy for Container
impl Eq for Container
Source§impl From<ContainerKind> for Container
impl From<ContainerKind> for Container
Source§fn from(c: ContainerKind) -> Self
fn from(c: ContainerKind) -> Self
Source§impl From<TypeContainer> for Container
impl From<TypeContainer> for Container
Source§fn from(c: TypeContainer) -> Self
fn from(c: TypeContainer) -> Self
impl StructuralPartialEq for Container
Auto Trait Implementations§
impl Freeze for Container
impl RefUnwindSafe for Container
impl Send for Container
impl Sync for Container
impl Unpin for Container
impl UnsafeUnpin for Container
impl UnwindSafe for Container
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.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.