#[non_exhaustive]pub struct NotificationRequest {
pub event_type: String,
pub identifier: BTreeMap<String, Value>,
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
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, Value>Identifier key/value pairs, per the schema for event_type.
Values retain their JSON shape. Spatial identifiers use arrays, such as
[46.0, 8.0] for a point or [[46.0, 8.0], [47.0, 9.0]] for a point
cloud.
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, Value>) -> Self
pub fn with_identifier(self, identifier: BTreeMap<String, Value>) -> Self
Replaces the identifier map. Builder-style consumes and returns self.
Values retain their JSON shape, including scalars, arrays, and objects.
Sourcepub fn with_string_identifier(
self,
identifier: BTreeMap<String, String>,
) -> Self
pub fn with_string_identifier( self, identifier: BTreeMap<String, String>, ) -> Self
Replaces the identifier map with string values converted to JSON strings.
Use Self::with_identifier when any value is not a string.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more