pub struct Utm {
pub utm_source: Option<String>,
pub utm_medium: Option<String>,
pub utm_campaign: Option<String>,
pub utm_content: Option<String>,
pub utm_term: Option<String>,
}Expand description
UTM campaign tracking parameters.
Fields§
§utm_source: Option<String>UTM source parameter.
utm_medium: Option<String>UTM medium parameter.
utm_campaign: Option<String>UTM campaign parameter.
utm_content: Option<String>UTM content parameter.
utm_term: Option<String>UTM keyword / term parameter.
Implementations§
Source§impl Utm
impl Utm
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a Utm with all fields None.
Use the with_* builder methods to populate individual UTM
parameters. Only non-None fields are serialised into the JSON.
§Returns
An empty Utm instance.
§Example
use cow_app_data::Utm;
let utm = Utm::new().with_source("twitter").with_campaign("launch-2025");
assert!(utm.has_source());
assert!(utm.has_campaign());
assert!(!utm.has_medium());Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Sourcepub fn with_medium(self, medium: impl Into<String>) -> Self
pub fn with_medium(self, medium: impl Into<String>) -> Self
Sourcepub fn with_campaign(self, campaign: impl Into<String>) -> Self
pub fn with_campaign(self, campaign: impl Into<String>) -> Self
Sourcepub fn with_content(self, content: impl Into<String>) -> Self
pub fn with_content(self, content: impl Into<String>) -> Self
Sourcepub const fn has_source(&self) -> bool
pub const fn has_source(&self) -> bool
Returns true if the utm_source parameter is set.
Sourcepub const fn has_medium(&self) -> bool
pub const fn has_medium(&self) -> bool
Returns true if the utm_medium parameter is set.
Sourcepub const fn has_campaign(&self) -> bool
pub const fn has_campaign(&self) -> bool
Returns true if the utm_campaign parameter is set.
Sourcepub const fn has_content(&self) -> bool
pub const fn has_content(&self) -> bool
Returns true if the utm_content parameter is set.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Utm
impl<'de> Deserialize<'de> for Utm
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
Auto Trait Implementations§
impl Freeze for Utm
impl RefUnwindSafe for Utm
impl Send for Utm
impl Sync for Utm
impl Unpin for Utm
impl UnsafeUnpin for Utm
impl UnwindSafe for Utm
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
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.