pub struct PublicationConfig {
pub group: Ipv4Addr,
pub dst_port: u16,
pub interface: Option<Ipv4Addr>,
pub source_port: Option<u16>,
pub ttl: u32,
pub loopback: bool,
}Expand description
Configuration for one multicast publication socket.
Fields§
§group: Ipv4AddrThe destination multicast group.
dst_port: u16The destination UDP port.
interface: Option<Ipv4Addr>The local interface to use for multicast egress, if explicitly set.
source_port: Option<u16>The source UDP port to bind before sending, if explicitly set.
ttl: u32The multicast TTL for transmitted packets.
loopback: boolWhether outbound multicast packets should be looped back to the local host.
Implementations§
Source§impl PublicationConfig
impl PublicationConfig
Sourcepub fn new(group: Ipv4Addr, port: u16) -> Self
pub fn new(group: Ipv4Addr, port: u16) -> Self
Creates a basic multicast publication configuration.
Sourcepub fn validate(&self) -> Result<(), MctxError>
pub fn validate(&self) -> Result<(), MctxError>
Validates the configuration and returns an error if it is not usable.
Sourcepub fn with_interface(self, interface: Ipv4Addr) -> Self
pub fn with_interface(self, interface: Ipv4Addr) -> Self
Sets the multicast egress interface.
Sourcepub fn with_source_port(self, source_port: u16) -> Self
pub fn with_source_port(self, source_port: u16) -> Self
Sets the source UDP port.
Sourcepub fn with_loopback(self, loopback: bool) -> Self
pub fn with_loopback(self, loopback: bool) -> Self
Enables or disables multicast loopback.
Sourcepub fn destination(&self) -> SocketAddrV4
pub fn destination(&self) -> SocketAddrV4
Returns the configured destination socket address.
Trait Implementations§
Source§impl Clone for PublicationConfig
impl Clone for PublicationConfig
Source§fn clone(&self) -> PublicationConfig
fn clone(&self) -> PublicationConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PublicationConfig
impl Debug for PublicationConfig
Source§impl Hash for PublicationConfig
impl Hash for PublicationConfig
Source§impl PartialEq for PublicationConfig
impl PartialEq for PublicationConfig
Source§fn eq(&self, other: &PublicationConfig) -> bool
fn eq(&self, other: &PublicationConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for PublicationConfig
impl StructuralPartialEq for PublicationConfig
Auto Trait Implementations§
impl Freeze for PublicationConfig
impl RefUnwindSafe for PublicationConfig
impl Send for PublicationConfig
impl Sync for PublicationConfig
impl Unpin for PublicationConfig
impl UnsafeUnpin for PublicationConfig
impl UnwindSafe for PublicationConfig
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