diff --git a/shopify_function/src/scalars/decimal.rs b/shopify_function/src/scalars/decimal.rs index 403ff0a..00e2260 100644 --- a/shopify_function/src/scalars/decimal.rs +++ b/shopify_function/src/scalars/decimal.rs @@ -1,5 +1,5 @@ use serde::{Deserialize, Serialize}; -use std::str::FromStr; +use std::{ops::Deref, str::FromStr}; /// Convenience wrapper for converting between Shopify's `Decimal` scalar, which /// is serialized as a `String`, and Rust's `f64`. @@ -15,6 +15,14 @@ impl Decimal { } } +impl Deref for Decimal { + type Target = f64; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + impl TryFrom for Decimal { type Error = std::num::ParseFloatError;