pub struct AsyncService { /* private fields */ }async only.Expand description
High-level asynchronous SSDP service using tokio.
Handles incoming and outgoing searches using async, await, and the
Tokio crate.
Implementations§
Source§impl AsyncService
impl AsyncService
Sourcepub fn on_network_event(&self, event: &NetworkEvent) -> Result<(), Error>
pub fn on_network_event(&self, event: &NetworkEvent) -> Result<(), Error>
Notify the AsyncService of a network interface change
Network interface changes can be obtained from
cotton_netif::get_interfaces or
cotton_netif::get_interfaces_async, filtering if desired –
or, created manually.
Note that AsyncService will do nothing if it has no network
interfaces to work with.
§Panics
Will panic if the internal mutex cannot be locked; that would indicate a bug in cotton-ssdp.
Sourcepub fn subscribe<A>(
&mut self,
notification_type: A,
) -> impl Stream<Item = Notification>
pub fn subscribe<A>( &mut self, notification_type: A, ) -> impl Stream<Item = Notification>
Subscribe to SSDP notifications for a resource type.
§Panics
Will panic if the internal mutex cannot be locked; that would indicate a bug in cotton-ssdp.
Sourcepub fn advertise<USN>(
&mut self,
unique_service_name: USN,
advertisement: Advertisement,
)
pub fn advertise<USN>( &mut self, unique_service_name: USN, advertisement: Advertisement, )
Announce a new resource
And start responding to any searches matching it.
§Panics
Will panic if the internal mutex cannot be locked; that would indicate a bug in cotton-ssdp.
Sourcepub fn deadvertise(&mut self, unique_service_name: &str)
pub fn deadvertise(&mut self, unique_service_name: &str)
Announce the disappearance of a resource
And stop responding to searches.
§Panics
Will panic if the internal mutex cannot be locked; that would indicate a bug in cotton-ssdp.