pub struct Variable { /* private fields */ }Expand description
See relevant docs.
Implementations§
Source§impl Variable
impl Variable
Sourcepub fn new(key: impl Into<String>, ttype: VariableType) -> Self
pub fn new(key: impl Into<String>, ttype: VariableType) -> Self
Creates a new Variable.
key: The key of the variable. We recommend capitalizing the key (e.g.FIRST_NAME).ttype: The type of the variable. Can bestring,number,boolean,object, orlist.
Sourcepub fn with_fallback(self, fallback: impl Into<Value>) -> Self
pub fn with_fallback(self, fallback: impl Into<Value>) -> Self
Adds or overwrites the fallback value.
The fallback value of the variable. The value must match the type of the variable.
If no fallback value is provided, you must provide a value for the variable when sending an email using the template.
If object type is provided, you must include a fallback.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Variable
impl<'de> Deserialize<'de> for Variable
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
impl Eq for Variable
impl StructuralPartialEq for Variable
Auto Trait Implementations§
impl Freeze for Variable
impl RefUnwindSafe for Variable
impl Send for Variable
impl Sync for Variable
impl Unpin for Variable
impl UnwindSafe for Variable
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