pub struct MonetaryAmount {
pub currency: String,
pub amount: f64,
}Expand description
ISO 4217 monetary amount.
Skips serialisation when both fields are empty/zero — keeps the JSON-LD compact when authors leave the amount out of frontmatter.
Fields§
§currency: StringISO 4217 currency code (e.g. EUR, USD).
amount: f64Numeric amount.
Implementations§
Source§impl MonetaryAmount
impl MonetaryAmount
Sourcepub fn to_jsonld(&self) -> Value
pub fn to_jsonld(&self) -> Value
Renders to a Schema.org MonetaryAmount JSON value.
§Examples
use ssg::seo::jsonld::iso20022::MonetaryAmount;
let m = MonetaryAmount { currency: "EUR".into(), amount: 100.0 };
let v = m.to_jsonld();
assert_eq!(v["currency"], "EUR");
assert_eq!(v["value"], 100.0);Trait Implementations§
Source§impl Clone for MonetaryAmount
impl Clone for MonetaryAmount
Source§fn clone(&self) -> MonetaryAmount
fn clone(&self) -> MonetaryAmount
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 MonetaryAmount
impl Debug for MonetaryAmount
Source§impl<'de> Deserialize<'de> for MonetaryAmount
impl<'de> Deserialize<'de> for MonetaryAmount
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 MonetaryAmount
impl PartialEq for MonetaryAmount
Source§fn eq(&self, other: &MonetaryAmount) -> bool
fn eq(&self, other: &MonetaryAmount) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for MonetaryAmount
impl Serialize for MonetaryAmount
impl StructuralPartialEq for MonetaryAmount
Auto Trait Implementations§
impl Freeze for MonetaryAmount
impl RefUnwindSafe for MonetaryAmount
impl Send for MonetaryAmount
impl Sync for MonetaryAmount
impl Unpin for MonetaryAmount
impl UnsafeUnpin for MonetaryAmount
impl UnwindSafe for MonetaryAmount
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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