pub trait LocalService<T: ServerTypes> {
// Required methods
fn publish(&self) -> T::ServiceEventStream;
fn notify(&self, characteristic: &Handle, data: &[u8], peers: &[PeerId]);
fn indicate(
&self,
characteristic: &Handle,
data: &[u8],
peers: &[PeerId],
) -> T::IndicateConfirmationStream;
}Required Methods§
Sourcefn publish(&self) -> T::ServiceEventStream
fn publish(&self) -> T::ServiceEventStream
Publish the service. Returns an EventStream providing Events to be processed by the local service implementation. Events will only be delivered to one ServiceEventStream at a time. Calling publish while a previous ServiceEventStream is still active will return a stream with only Err(AlreadyPublished).
Sourcefn notify(&self, characteristic: &Handle, data: &[u8], peers: &[PeerId])
fn notify(&self, characteristic: &Handle, data: &[u8], peers: &[PeerId])
Notify a characteristic.
Leave peers empty to notify all peers who have configured
notifications. Peers that have not configured for notifications will
not be notified.
Sourcefn indicate(
&self,
characteristic: &Handle,
data: &[u8],
peers: &[PeerId],
) -> T::IndicateConfirmationStream
fn indicate( &self, characteristic: &Handle, data: &[u8], peers: &[PeerId], ) -> T::IndicateConfirmationStream
Indicate on a characteristic.
Leave peers empty to notify all peers who have configured
indications. Peers that have not configured for indications will
be skipped. Returns a stream which has items for each peer that
confirms the notification, and terminates when all peers have either
timed out or confirmed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".