#[non_exhaustive]pub struct NotificationRequest {
pub event_type: String,
pub identifier: BTreeMap<String, String>,
pub payload: Option<Value>,
}Expand description
A notification to publish via the server.
Marked #[non_exhaustive] so adding fields (for example, a future schema-version selector)
is not a breaking change. Downstream code constructs requests via Self::new and the
with_* builder methods rather than struct literals.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.event_type: StringEvent type, matching a schema configured on the server (for example mars).
identifier: BTreeMap<String, String>Identifier key/value pairs, per the schema for event_type.
payload: Option<Value>Optional free-form payload.
Implementations§
Source§impl NotificationRequest
impl NotificationRequest
Sourcepub fn new(event_type: impl Into<String>) -> Self
pub fn new(event_type: impl Into<String>) -> Self
Builds a NotificationRequest with the required event_type and empty defaults for
the other fields. Use Self::with_identifier and Self::with_payload to fill in.
Sourcepub fn with_identifier(self, identifier: BTreeMap<String, String>) -> Self
pub fn with_identifier(self, identifier: BTreeMap<String, String>) -> Self
Replaces the identifier map. Builder-style consumes and returns self.
Sourcepub fn with_payload(self, payload: Value) -> Self
pub fn with_payload(self, payload: Value) -> Self
Sets the payload to Some(value). Builder-style consumes and returns self.
Trait Implementations§
Source§impl Clone for NotificationRequest
impl Clone for NotificationRequest
Source§fn clone(&self) -> NotificationRequest
fn clone(&self) -> NotificationRequest
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 NotificationRequest
impl Debug for NotificationRequest
Auto Trait Implementations§
impl Freeze for NotificationRequest
impl RefUnwindSafe for NotificationRequest
impl Send for NotificationRequest
impl Sync for NotificationRequest
impl Unpin for NotificationRequest
impl UnsafeUnpin for NotificationRequest
impl UnwindSafe for NotificationRequest
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