Route

Struct Route 

Source
pub struct Route {
    pub resource_id: Arc<str>,
    pub producer: Box<dyn ProducerTrait>,
    pub deserializer: DeserializerFn,
}
Expand description

A single routing entry

Maps one (resource_id, type) pair to a producer and deserializer. Multiple routes can exist for the same resource_id (different types).

§Resource ID Examples

  • MQTT: “sensors/temperature” (topic)
  • Kafka: “events:0” (topic:partition)
  • HTTP: “/api/v1/sensors” (path)
  • DDS: “TelemetryData” (topic name)
  • Shmem: “temperature_buffer” (segment name)

Fields§

§resource_id: Arc<str>

Resource identifier to match (reference-counted for proper memory management)

Examples: MQTT topic, Kafka topic, HTTP path, DDS topic, shmem segment

Uses Arc instead of &’static str to avoid memory leaks from Box::leak(). This adds ~8 bytes overhead per route (Arc control block) but enables proper cleanup.

§producer: Box<dyn ProducerTrait>

Type-erased producer for this route

§deserializer: DeserializerFn

Deserializer for converting bytes → typed value

Auto Trait Implementations§

§

impl Freeze for Route

§

impl !RefUnwindSafe for Route

§

impl Send for Route

§

impl Sync for Route

§

impl Unpin for Route

§

impl !UnwindSafe for Route

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.