pub enum JsonLdValue {
Null,
Bool(bool),
Number(f64),
Str(String),
Array(Vec<JsonLdValue>),
Object(IndexMap<String, JsonLdValue>),
}Expand description
A JSON-LD value that can appear in an expanded or compact JSON-LD document.
Uses IndexMap for objects to maintain insertion order (required by JSON-LD spec).
Variants§
Null
JSON null.
Bool(bool)
JSON boolean.
Number(f64)
JSON number.
Str(String)
JSON string.
Array(Vec<JsonLdValue>)
JSON array.
Object(IndexMap<String, JsonLdValue>)
JSON object with insertion-ordered keys.
Implementations§
Source§impl JsonLdValue
impl JsonLdValue
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns the string value if this is a Str, otherwise None.
Sourcepub fn as_object(&self) -> Option<&IndexMap<String, JsonLdValue>>
pub fn as_object(&self) -> Option<&IndexMap<String, JsonLdValue>>
Returns the object map if this is an Object, otherwise None.
Sourcepub fn as_array(&self) -> Option<&[JsonLdValue]>
pub fn as_array(&self) -> Option<&[JsonLdValue]>
Returns the array if this is an Array, otherwise None.
Sourcepub fn into_array_if_not(self) -> Vec<JsonLdValue>
pub fn into_array_if_not(self) -> Vec<JsonLdValue>
Wraps a value in a single-element array.
Trait Implementations§
Source§impl Clone for JsonLdValue
impl Clone for JsonLdValue
Source§fn clone(&self) -> JsonLdValue
fn clone(&self) -> JsonLdValue
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 moreSource§impl Debug for JsonLdValue
impl Debug for JsonLdValue
Source§impl PartialEq for JsonLdValue
impl PartialEq for JsonLdValue
impl StructuralPartialEq for JsonLdValue
Auto Trait Implementations§
impl Freeze for JsonLdValue
impl RefUnwindSafe for JsonLdValue
impl Send for JsonLdValue
impl Sync for JsonLdValue
impl Unpin for JsonLdValue
impl UnsafeUnpin for JsonLdValue
impl UnwindSafe for JsonLdValue
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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