#[non_exhaustive]pub enum SchemaValue {
Text(String),
Url(String),
Node(Box<SchemaNode>),
Boolean(bool),
Number(f64),
DateTime(String),
}Expand description
A value within a structured data node.
Represents the different value types that a Schema.org property can hold.
Properties are multi-valued (stored as Vec<SchemaValue> in SchemaNode).
§PartialEq note
The Number(f64) variant uses f64 partial equality via the derived impl.
This means NaN != NaN, which is acceptable for test assertions but not for
production equality checks.
§Examples
use schemaorg_rs::types::SchemaValue;
let text = SchemaValue::Text("Widget".into());
let url = SchemaValue::Url("https://example.com".into());
let flag = SchemaValue::Boolean(true);
let price = SchemaValue::Number(29.99);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text(String)
Plain text content.
Url(String)
A URL value (starts with http://, https://, or mailto:).
Node(Box<SchemaNode>)
A nested structured data node.
Boolean(bool)
A boolean value.
Number(f64)
A numeric value (IEEE 754 f64).
DateTime(String)
A raw datetime string. Actual datetime validation happens in M2.
Trait Implementations§
Source§impl Clone for SchemaValue
impl Clone for SchemaValue
Source§fn clone(&self) -> SchemaValue
fn clone(&self) -> SchemaValue
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 SchemaValue
impl Debug for SchemaValue
Source§impl<'de> Deserialize<'de> for SchemaValue
impl<'de> Deserialize<'de> for SchemaValue
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 Display for SchemaValue
impl Display for SchemaValue
Source§impl PartialEq for SchemaValue
impl PartialEq for SchemaValue
Source§fn eq(&self, other: &SchemaValue) -> bool
fn eq(&self, other: &SchemaValue) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SchemaValue
impl Serialize for SchemaValue
impl StructuralPartialEq for SchemaValue
Auto Trait Implementations§
impl Freeze for SchemaValue
impl RefUnwindSafe for SchemaValue
impl Send for SchemaValue
impl Sync for SchemaValue
impl Unpin for SchemaValue
impl UnsafeUnpin for SchemaValue
impl UnwindSafe for SchemaValue
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