Skip to main content

Peer

Enum Peer 

Source
pub enum Peer {
    Udp(PeerAddr),
    Ble(u16),
    Tcp(PeerAddr, u16),
}
Expand description

Where a Matter message came from, or goes to, whichever transport carried it.

A Matter node speaks more than one at once: during commissioning a device may be answering BLE on one side and advertising over IPv6 on the other, and the reply to a message has to go back the way it came.

The distinction is not only routing. Core §4.12.4:

Reliable messages sent over TCP, PAFTP, or BTP SHALL utilize the underlying reliability mechanisms of those transports and SHOULD NOT set the R Flag.

So which transport a peer is on decides whether MRP runs at all, and Messaging reads it from here rather than trusting each caller to remember.

Variants§

§

Udp(PeerAddr)

A UDP peer, addressed by IPv6. MRP supplies the reliability.

§

Ble(u16)

A BLE peer, named by whatever handle the platform’s stack uses for the connection. btp supplies the reliability.

§

Tcp(PeerAddr, u16)

A TCP peer: an address, plus the connection the stream arrived on.

The address alone does not identify it. Core §4.15.2 lets two nodes hold more than one connection at a time, and a reply has to go back down the one the request came up, so the platform’s own handle for the socket travels with the address. tcp supplies the reliability.

Implementations§

Source§

impl Peer

Source

pub const fn is_reliable(&self) -> bool

Whether the transport is reliable on its own, so §4.12.4 says not to set the R flag.

Source

pub const fn supports_large_payloads(&self) -> bool

Whether the transport can carry a message larger than the 1280-octet IPv6 minimum MTU, so a Large Message command (§4.4.4) may be sent over it.

Only TCP can. §4.4.4: “The maximum size of the payload for messages sent over a TCP connection is 1,048,576 octets”, against 1280 for everything datagram-shaped. This is what an application passes to InteractionContext::with_large_messages, so the data model’s L quality is enforced against the transport that is actually underneath rather than against a build-time guess.

Source

pub const fn addr(&self) -> Option<PeerAddr>

The IPv6 address, when there is one.

Trait Implementations§

Source§

impl Clone for Peer

Source§

fn clone(&self) -> Self

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 Copy for Peer

Source§

impl Debug for Peer

Source§

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

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

impl Eq for Peer

Source§

impl From<PeerAddr> for Peer

Source§

fn from(addr: PeerAddr) -> Self

Converts to this type from the input type.
Source§

impl Hash for Peer

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 Peer

Source§

fn eq(&self, other: &Self) -> 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 Peer

Auto Trait Implementations§

§

impl Forget for Peer

§

impl Freeze for Peer

§

impl Move for Peer

§

impl RefUnwindSafe for Peer

§

impl Send for Peer

§

impl Sync for Peer

§

impl Unpin for Peer

§

impl UnsafeUnpin for Peer

§

impl UnwindSafe for Peer

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.