pub struct Widget {
pub app_code: String,
pub environment: Option<String>,
}Expand description
Widget integration metadata.
Fields§
§app_code: StringApp code of the widget host.
environment: Option<String>Deployment environment of the widget.
Implementations§
Source§impl Widget
impl Widget
Sourcepub fn new(app_code: impl Into<String>) -> Self
pub fn new(app_code: impl Into<String>) -> Self
Construct a new Widget for the given app code.
Used when an order originates from an embedded widget integration.
The app_code identifies the widget host application.
§Parameters
app_code— the widget host’s application identifier.
§Returns
A new Widget with environment set to None.
§Example
use cow_rs::app_data::Widget;
let w = Widget::new("WidgetHost").with_environment("production");
assert_eq!(w.app_code, "WidgetHost");
assert!(w.has_environment());Sourcepub fn with_environment(self, env: impl Into<String>) -> Self
pub fn with_environment(self, env: impl Into<String>) -> Self
Sourcepub const fn has_environment(&self) -> bool
pub const fn has_environment(&self) -> bool
Returns true if a deployment environment string is set.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Widget
impl<'de> Deserialize<'de> for Widget
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 Widget
impl RefUnwindSafe for Widget
impl Send for Widget
impl Sync for Widget
impl Unpin for Widget
impl UnsafeUnpin for Widget
impl UnwindSafe for Widget
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> 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 moreSource§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.