pub struct Subscription {
pub id: String,
pub client_id: String,
pub subscription_type: SubscriptionType,
pub filter: Option<SubscriptionFilter>,
}Expand description
A subscription to WebSocket updates.
Fields§
§id: StringUnique subscription ID
client_id: StringClient ID that owns this subscription
subscription_type: SubscriptionTypeSubscription type
filter: Option<SubscriptionFilter>Optional filter
Implementations§
Source§impl Subscription
impl Subscription
Sourcepub fn new(
client_id: String,
subscription_type: SubscriptionType,
filter: Option<SubscriptionFilter>,
) -> Self
pub fn new( client_id: String, subscription_type: SubscriptionType, filter: Option<SubscriptionFilter>, ) -> Self
Create a new subscription.
Sourcepub fn tiles(
client_id: String,
bbox: [f64; 4],
zoom_range: Range<u8>,
filter: Option<SubscriptionFilter>,
) -> Self
pub fn tiles( client_id: String, bbox: [f64; 4], zoom_range: Range<u8>, filter: Option<SubscriptionFilter>, ) -> Self
Create a tile subscription.
Sourcepub fn features(
client_id: String,
layer: Option<String>,
filter: Option<SubscriptionFilter>,
) -> Self
pub fn features( client_id: String, layer: Option<String>, filter: Option<SubscriptionFilter>, ) -> Self
Create a feature subscription.
Sourcepub fn events(
client_id: String,
event_types: HashSet<EventType>,
filter: Option<SubscriptionFilter>,
) -> Self
pub fn events( client_id: String, event_types: HashSet<EventType>, filter: Option<SubscriptionFilter>, ) -> Self
Create an event subscription.
Sourcepub fn matches_tile(&self, tile_x: u32, tile_y: u32, zoom: u8) -> bool
pub fn matches_tile(&self, tile_x: u32, tile_y: u32, zoom: u8) -> bool
Check if a tile matches this subscription.
Sourcepub fn matches_feature(&self, layer: Option<&str>) -> bool
pub fn matches_feature(&self, layer: Option<&str>) -> bool
Check if a feature matches this subscription.
Sourcepub fn matches_event(&self, event_type: EventType) -> bool
pub fn matches_event(&self, event_type: EventType) -> bool
Check if an event matches this subscription.
Trait Implementations§
Source§impl Clone for Subscription
impl Clone for Subscription
Source§fn clone(&self) -> Subscription
fn clone(&self) -> Subscription
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Subscription
impl RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl UnsafeUnpin for Subscription
impl UnwindSafe for Subscription
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