[][src]Struct ether_dream_dac_emulator::broadcaster::Broadcaster

pub struct Broadcaster { /* fields omitted */ }

The broadcasting side of the DAC.

Once run is called, the broadcaster will block and loop at a rate of once-per-second, broadcasting the current state of the DAC on each iteration.

Methods

impl Broadcaster[src]

pub fn new(
    dac: Addressed,
    bind_port: u16,
    broadcast_ip: Ipv4Addr
) -> Result<Broadcaster>
[src]

Create a new Broadcaster initialised with the given DAC state.

Produces an io::Error if creating the UDP socket fails or if enabling broadcast fails.

pub fn create_broadcast(&self) -> DacBroadcast[src]

Creates a DacBroadcast from the current known DAC state.

This is used within the send method.

pub fn send(&mut self) -> Result<()>[src]

Sends a single broadcast message over the inner UDP socket.

pub fn run(&mut self, rx: Rx) -> Result<()>[src]

Run the Broadcaster.

The broadcaster will block on the given receiver, waiting to process Messages.

On each Message::Second received, the Broadcaster will send a message over UDP.

On each Message::Dac, the Broadcaster will update the current DAC state.

pub fn spawn(self) -> Result<Handle>[src]

Consumes the Broadcaster and calls the run method on a separate thread.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.