Struct station::pubsub::Subscriber [−][src]
pub struct Subscriber { /* fields omitted */ }
Expand description
The Subscriber receives messages of type T
and processes them with a callback.
Implementations
pub fn with_udp_port<T>(
name: &'static str,
port: u16,
callback: Box<dyn Send + Fn(T)>
) -> Subscriber where
T: Debug + DeserializeOwned + Serialize + 'static,
pub fn with_udp_port<T>(
name: &'static str,
port: u16,
callback: Box<dyn Send + Fn(T)>
) -> Subscriber where
T: Debug + DeserializeOwned + Serialize + 'static,
Create a subscriber that listens on a UDP port.
Args:
name
The name to refer to the subscriber.port
: The UDP port to listen for new messages on.callback
: The function to call on incoming data.
pub fn with_unix_datagram<T>(
name: &'static str,
path: &Path,
callback: Box<dyn Send + Fn(T)>
) -> Subscriber where
T: Debug + DeserializeOwned + Serialize + 'static,
pub fn with_unix_datagram<T>(
name: &'static str,
path: &Path,
callback: Box<dyn Send + Fn(T)>
) -> Subscriber where
T: Debug + DeserializeOwned + Serialize + 'static,
Create a subscriber that listens on a Unix Datagram socket.
Args:
name
The name to refer to the subscriber.path
: The unix socket path to bind the server to.callback
: The function to call on incoming data.
Check if the Subscriber is running.