pub struct CollectionRouteTable { /* private fields */ }Expand description
Lookup table for per-collection transport routing
Maps collection names to their transport routing configuration.
Collections not in this table fall through to legacy scoring
via route_message().
§Example
use peat_mesh::transport::{
CollectionRouteTable, CollectionRouteConfig, CollectionTransportRoute,
TransportType, MessagePriority,
};
let table = CollectionRouteTable::new()
.with_collection(CollectionRouteConfig {
collection: "telemetry".to_string(),
route: CollectionTransportRoute::Fixed {
transport_type: TransportType::BluetoothLE,
},
priority: MessagePriority::Normal,
});
assert!(table.has_collection("telemetry"));
assert!(!table.has_collection("unknown"));Implementations§
Source§impl CollectionRouteTable
impl CollectionRouteTable
Sourcepub fn with_collection(self, config: CollectionRouteConfig) -> Self
pub fn with_collection(self, config: CollectionRouteConfig) -> Self
Add a collection route configuration (builder pattern)
Sourcepub fn get(&self, collection: &str) -> Option<&CollectionRouteConfig>
pub fn get(&self, collection: &str) -> Option<&CollectionRouteConfig>
Get the route config for a collection
Sourcepub fn has_collection(&self, collection: &str) -> bool
pub fn has_collection(&self, collection: &str) -> bool
Check if a collection has a route configured
Trait Implementations§
Source§impl Clone for CollectionRouteTable
impl Clone for CollectionRouteTable
Source§fn clone(&self) -> CollectionRouteTable
fn clone(&self) -> CollectionRouteTable
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 moreSource§impl Debug for CollectionRouteTable
impl Debug for CollectionRouteTable
Source§impl Default for CollectionRouteTable
impl Default for CollectionRouteTable
Source§fn default() -> CollectionRouteTable
fn default() -> CollectionRouteTable
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CollectionRouteTable
impl<'de> Deserialize<'de> for CollectionRouteTable
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 CollectionRouteTable
impl RefUnwindSafe for CollectionRouteTable
impl Send for CollectionRouteTable
impl Sync for CollectionRouteTable
impl Unpin for CollectionRouteTable
impl UnsafeUnpin for CollectionRouteTable
impl UnwindSafe for CollectionRouteTable
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