PacketBuilder

Struct PacketBuilder 

Source
pub struct PacketBuilder<'a> { /* private fields */ }
Expand description

Entry point for typestate packet construction.

The builder consumes itself as it transitions through required stages so invalid packet layouts are rejected at compile time where possible.

Implementations§

Source§

impl<'a> PacketBuilder<'a>

Source

pub fn new(buf: &'a mut [u8]) -> Self

Start building a packet into buf.

Source

pub fn broadcast(self) -> BroadcastBuilder<'a, NeedsSource>

Begin a broadcast packet.

Source

pub fn mac_ack( self, dst: NodeHint, ack_tag: [u8; 8], ) -> MacAckBuilder<'a, Configuring>

Build a MAC ACK packet with all required addressing fixed up front.

Source

pub fn unicast(self, dst: NodeHint) -> UnicastBuilder<'a, NeedsSource>

Begin a unicast packet to dst.

Source

pub fn multicast(self, channel: ChannelId) -> MulticastBuilder<'a, NeedsSource>

Begin a multicast packet on channel.

Source

pub fn blind_unicast( self, channel: ChannelId, dst: NodeHint, ) -> BlindUnicastBuilder<'a, NeedsSource>

Begin a blind-unicast packet addressed through channel to dst.

Auto Trait Implementations§

§

impl<'a> Freeze for PacketBuilder<'a>

§

impl<'a> RefUnwindSafe for PacketBuilder<'a>

§

impl<'a> Send for PacketBuilder<'a>

§

impl<'a> Sync for PacketBuilder<'a>

§

impl<'a> Unpin for PacketBuilder<'a>

§

impl<'a> !UnwindSafe for PacketBuilder<'a>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.