pub struct Context { /* private fields */ }Expand description
Small owner for a set of multicast publication sockets.
Implementations§
Source§impl Context
impl Context
Sourcepub fn publication_count(&self) -> usize
pub fn publication_count(&self) -> usize
Returns the number of tracked publications.
Sourcepub fn contains_publication(&self, id: PublicationId) -> bool
pub fn contains_publication(&self, id: PublicationId) -> bool
Returns whether a publication ID exists in the context.
Sourcepub fn get_publication(&self, id: PublicationId) -> Option<&Publication>
pub fn get_publication(&self, id: PublicationId) -> Option<&Publication>
Returns an immutable reference to one publication.
Sourcepub fn get_publication_mut(
&mut self,
id: PublicationId,
) -> Option<&mut Publication>
pub fn get_publication_mut( &mut self, id: PublicationId, ) -> Option<&mut Publication>
Returns a mutable reference to one publication.
Sourcepub fn add_publication(
&mut self,
config: PublicationConfig,
) -> Result<PublicationId, MctxError>
pub fn add_publication( &mut self, config: PublicationConfig, ) -> Result<PublicationId, MctxError>
Creates a new publication socket from configuration and stores it.
Sourcepub fn add_publication_with_socket(
&mut self,
config: PublicationConfig,
socket: Socket,
) -> Result<PublicationId, MctxError>
pub fn add_publication_with_socket( &mut self, config: PublicationConfig, socket: Socket, ) -> Result<PublicationId, MctxError>
Stores an existing socket as a publication after configuring it.
Sourcepub fn add_publication_with_udp_socket(
&mut self,
config: PublicationConfig,
socket: UdpSocket,
) -> Result<PublicationId, MctxError>
pub fn add_publication_with_udp_socket( &mut self, config: PublicationConfig, socket: UdpSocket, ) -> Result<PublicationId, MctxError>
Stores an existing standard-library UDP socket as a publication after configuring it.
Sourcepub fn remove_publication(&mut self, id: PublicationId) -> bool
pub fn remove_publication(&mut self, id: PublicationId) -> bool
Removes one publication and drops its socket.
Sourcepub fn take_publication(&mut self, id: PublicationId) -> Option<Publication>
pub fn take_publication(&mut self, id: PublicationId) -> Option<Publication>
Extracts one publication from the context.
Sourcepub fn publications(&self) -> &[Publication]
pub fn publications(&self) -> &[Publication]
Returns all tracked publications.
Sourcepub fn publications_mut(&mut self) -> &mut [Publication]
pub fn publications_mut(&mut self) -> &mut [Publication]
Returns all tracked publications mutably.
Sourcepub fn send(
&self,
id: PublicationId,
payload: &[u8],
) -> Result<SendReport, MctxError>
pub fn send( &self, id: PublicationId, payload: &[u8], ) -> Result<SendReport, MctxError>
Sends one payload through the selected publication.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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