Skip to main content

Publication

Struct Publication 

Source
pub struct Publication { /* private fields */ }
Expand description

One ready-to-send multicast publication.

Implementations§

Source§

impl Publication

Source

pub fn new( id: PublicationId, config: PublicationConfig, ) -> Result<Self, MctxError>

Creates and configures a new multicast publication socket.

Source

pub fn new_with_socket( id: PublicationId, config: PublicationConfig, socket: Socket, ) -> Result<Self, MctxError>

Wraps and configures an existing multicast socket.

Source

pub fn new_with_udp_socket( id: PublicationId, config: PublicationConfig, socket: UdpSocket, ) -> Result<Self, MctxError>

Wraps and configures an existing standard-library UDP socket.

Source

pub fn id(&self) -> PublicationId

Returns the publication ID.

Source

pub fn config(&self) -> &PublicationConfig

Returns the configured publication parameters.

Source

pub fn destination(&self) -> SocketAddr

Returns the resolved destination address.

Source

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

Returns the resolved destination IPv4 address.

Source

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

Returns the resolved destination IPv6 address.

Source

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.

Source

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.

Source

pub fn send(&self, payload: &[u8]) -> Result<SendReport, MctxError>

Sends one payload.

Source

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

Returns the publication socket local address.

Source

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

Returns the publication socket local IPv4 address.

Source

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

Returns the publication socket local IPv6 address.

Source

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

Returns the effective local source address.

Source

pub fn announce_tuple(&self) -> Result<(IpAddr, IpAddr, u16), MctxError>

Returns the (source, group, udp_port) tuple needed for announce frames.

Source

pub fn into_socket(self) -> Socket

Consumes the publication and returns the live socket.

Source

pub fn into_parts(self) -> PublicationParts

Consumes the publication and returns all parts.

Trait Implementations§

Source§

impl AsRawFd for Publication

Available on Unix only.
Source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
Source§

impl Debug for Publication

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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.