pub struct Publication { /* private fields */ }Expand description
One ready-to-send multicast publication.
Implementations§
Source§impl Publication
impl Publication
Sourcepub fn new(
id: PublicationId,
config: PublicationConfig,
) -> Result<Self, MctxError>
pub fn new( id: PublicationId, config: PublicationConfig, ) -> Result<Self, MctxError>
Creates and configures a new multicast publication socket.
Sourcepub fn new_with_socket(
id: PublicationId,
config: PublicationConfig,
socket: Socket,
) -> Result<Self, MctxError>
pub fn new_with_socket( id: PublicationId, config: PublicationConfig, socket: Socket, ) -> Result<Self, MctxError>
Wraps and configures an existing multicast socket.
Sourcepub fn new_with_udp_socket(
id: PublicationId,
config: PublicationConfig,
socket: UdpSocket,
) -> Result<Self, MctxError>
pub fn new_with_udp_socket( id: PublicationId, config: PublicationConfig, socket: UdpSocket, ) -> Result<Self, MctxError>
Wraps and configures an existing standard-library UDP socket.
Sourcepub fn id(&self) -> PublicationId
pub fn id(&self) -> PublicationId
Returns the publication ID.
Sourcepub fn config(&self) -> &PublicationConfig
pub fn config(&self) -> &PublicationConfig
Returns the configured publication parameters.
Sourcepub fn destination(&self) -> SocketAddr
pub fn destination(&self) -> SocketAddr
Returns the resolved destination address.
Sourcepub fn destination_v4(&self) -> Result<SocketAddrV4, MctxError>
pub fn destination_v4(&self) -> Result<SocketAddrV4, MctxError>
Returns the resolved destination IPv4 address.
Sourcepub fn destination_v6(&self) -> Result<SocketAddrV6, MctxError>
pub fn destination_v6(&self) -> Result<SocketAddrV6, MctxError>
Returns the resolved destination IPv6 address.
Sourcepub fn socket(&self) -> &Socket ⓘ
pub fn socket(&self) -> &Socket ⓘ
Returns a shared reference to the live socket.
Avoid rebinding or reconnecting the socket through this handle. The publication caches its resolved local address after the first lookup for send reporting, and shared-reference socket mutation cannot invalidate that cache.
Sourcepub fn socket_mut(&mut self) -> &mut Socket ⓘ
pub fn socket_mut(&mut self) -> &mut Socket ⓘ
Returns a mutable reference to the live socket.
This clears any cached local-address metadata before handing the socket
out so the next send or local_addr() call refreshes it.
Sourcepub fn local_addr(&self) -> Result<SocketAddr, MctxError>
pub fn local_addr(&self) -> Result<SocketAddr, MctxError>
Returns the publication socket local address.
Sourcepub fn local_addr_v4(&self) -> Result<SocketAddrV4, MctxError>
pub fn local_addr_v4(&self) -> Result<SocketAddrV4, MctxError>
Returns the publication socket local IPv4 address.
Sourcepub fn local_addr_v6(&self) -> Result<SocketAddrV6, MctxError>
pub fn local_addr_v6(&self) -> Result<SocketAddrV6, MctxError>
Returns the publication socket local IPv6 address.
Sourcepub fn source_addr(&self) -> Result<IpAddr, MctxError>
pub fn source_addr(&self) -> Result<IpAddr, MctxError>
Returns the effective local source address.
Sourcepub fn announce_tuple(&self) -> Result<(IpAddr, IpAddr, u16), MctxError>
pub fn announce_tuple(&self) -> Result<(IpAddr, IpAddr, u16), MctxError>
Returns the (source, group, udp_port) tuple needed for announce frames.
Sourcepub fn into_socket(self) -> Socket ⓘ
pub fn into_socket(self) -> Socket ⓘ
Consumes the publication and returns the live socket.
Sourcepub fn into_parts(self) -> PublicationParts
pub fn into_parts(self) -> PublicationParts
Consumes the publication and returns all parts.