pub struct JsonLdHeader {
pub context: Option<JsonLdContext>,
pub id: Option<String>,
pub type_: Option<TypeOrVec>,
}Expand description
Represents the JSON-LD document header, containing context, id, and type definitions. This structure is used as the envelope for JSON-LD documents and nodes.
The fields correspond to the standard JSON-LD keywords:
@context: Describes the term definitions and mapping information; can be an IRI, an object, or an array of contexts.@id: The node identifier, usually as an IRI string.@type: The semantic type(s) of the node as a string or array of strings.
Fields§
§context: Option<JsonLdContext>§id: Option<String>§type_: Option<TypeOrVec>Implementations§
Source§impl JsonLdHeader
impl JsonLdHeader
Sourcepub fn add_term(&mut self, name: &str, term: TermDef)
pub fn add_term(&mut self, name: &str, term: TermDef)
Add a new term definition to the context, creating the context object if not present.
§Arguments
name- The key/term to be added to the@contextterm- The associated mapping (simple IRI, detailed mapping, or null)
Sourcepub fn update_term(&mut self, name: &str, term: TermDef)
pub fn update_term(&mut self, name: &str, term: TermDef)
Insert or replace a term definition in the context.
Sourcepub fn remove_term(&mut self, name: &str) -> bool
pub fn remove_term(&mut self, name: &str) -> bool
Remove a term from the context. Returns true if the term existed and was removed.
Sourcepub fn add_import(&mut self, import_url: impl Into<String>)
pub fn add_import(&mut self, import_url: impl Into<String>)
Add an @import field as required by JSON-LD 1.1.
If @import already exists, merges multiple contexts into an array.
§Arguments
import_url- The URL (IRI) to include with@import.
Trait Implementations§
Source§impl Clone for JsonLdHeader
impl Clone for JsonLdHeader
Source§fn clone(&self) -> JsonLdHeader
fn clone(&self) -> JsonLdHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsonLdHeader
impl Debug for JsonLdHeader
Source§impl Default for JsonLdHeader
impl Default for JsonLdHeader
Source§fn default() -> JsonLdHeader
fn default() -> JsonLdHeader
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for JsonLdHeader
impl<'de> Deserialize<'de> for JsonLdHeader
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for JsonLdHeader
impl PartialEq for JsonLdHeader
Source§impl Serialize for JsonLdHeader
impl Serialize for JsonLdHeader
impl Eq for JsonLdHeader
impl StructuralPartialEq for JsonLdHeader
Auto Trait Implementations§
impl Freeze for JsonLdHeader
impl RefUnwindSafe for JsonLdHeader
impl Send for JsonLdHeader
impl Sync for JsonLdHeader
impl Unpin for JsonLdHeader
impl UnsafeUnpin for JsonLdHeader
impl UnwindSafe for JsonLdHeader
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
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§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
Compare self to
key and return true if they are equal.