Skip to main content

PublicationConfig

Struct PublicationConfig 

Source
pub struct PublicationConfig {
    pub group: IpAddr,
    pub dst_port: u16,
    pub outgoing_interface: Option<OutgoingInterface>,
    pub source_port: Option<u16>,
    pub source_addr: Option<IpAddr>,
    pub ttl: u32,
    pub loopback: bool,
}
Expand description

Configuration for one multicast publication socket.

Fields§

§group: IpAddr

The destination multicast group.

§dst_port: u16

The destination UDP port.

§outgoing_interface: Option<OutgoingInterface>

The explicit multicast egress interface, if set.

§source_port: Option<u16>

The source UDP port to bind before sending, if explicitly set.

§source_addr: Option<IpAddr>

The source IP address to bind before sending, if explicitly set.

§ttl: u32

The multicast TTL (IPv4) or hop limit (IPv6) for transmitted packets.

§loopback: bool

Whether outbound multicast packets should be looped back to the local host.

Implementations§

Source§

impl PublicationConfig

Source

pub fn new(group: impl Into<IpAddr>, port: u16) -> Self

Creates a basic multicast publication configuration.

Source

pub fn family(&self) -> PublicationAddressFamily

Returns the address family for this publication.

Source

pub fn is_ipv4(&self) -> bool

Returns true when the publication targets an IPv4 group.

Source

pub fn is_ipv6(&self) -> bool

Returns true when the publication targets an IPv6 group.

Source

pub fn validate(&self) -> Result<(), MctxError>

Validates the configuration and returns an error if it is not usable.

Source

pub fn with_outgoing_interface( self, outgoing_interface: impl Into<OutgoingInterface>, ) -> Self

Sets the multicast egress interface.

Source

pub fn with_interface(self, interface: Ipv4Addr) -> Self

Sets the multicast egress interface using the existing IPv4-oriented convenience builder.

Source

pub fn with_ipv6_interface_index(self, interface_index: u32) -> Self

Sets the IPv6 multicast egress interface by interface index.

Source

pub fn with_source_port(self, source_port: u16) -> Self

Sets the source UDP port.

Source

pub fn with_source_addr(self, source_addr: impl Into<IpAddr>) -> Self

Sets the exact local source address to bind before sending.

Source

pub fn with_bind_addr(self, bind_addr: impl Into<SocketAddr>) -> Self

Sets the exact local address and UDP port to bind before sending.

Source

pub fn with_ttl(self, ttl: u32) -> Self

Sets the multicast TTL (IPv4) or hop limit (IPv6).

Source

pub fn with_loopback(self, loopback: bool) -> Self

Enables or disables multicast loopback.

Source

pub fn ipv6_scope(&self) -> Option<Ipv6MulticastScope>

Returns the multicast scope for the configured IPv6 group, if applicable.

Trait Implementations§

Source§

impl Clone for PublicationConfig

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for PublicationConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PublicationConfig

Source§

impl Hash for PublicationConfig

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PublicationConfig

Source§

fn eq(&self, other: &PublicationConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PublicationConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.