Skip to main content

MatterControllerBuilder

Struct MatterControllerBuilder 

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

Configures and opens a MatterController.

Implementations§

Source§

impl MatterControllerBuilder

Source

pub fn attestation_trust(self, trust: AttestationTrust) -> Self

Set the device-attestation trust material. Required to commission.

Source

pub fn admin_vendor_id(self, vid: u16) -> Self

Override the admin vendor id used in AddNOC (default 0xFFF1).

Source

pub fn multicast_interface(self, if_index: u32) -> Self

Set the IPv6 multicast egress interface (an if_nametoindex value) used for group commands (invoke_group). On a multi-homed host the kernel default has no route for the admin-local ff35: group address and group sends fail with “No route to host” — pick the LAN-facing interface. When unset, the MATTER_MULTICAST_IF env var is honored as a compat fallback, then the kernel default.

Source

pub fn discovery<D>(self, discovery: D) -> Self
where D: Discovery + Send + 'static,

Supply your own mDNS stack instead of the built-in one.

§What the default is

Leave this unset and the controller starts MdnsSdDiscovery — a pure-Rust responder built on the mdns-sd crate, with no system daemon required. That remains the default and is not going away; this method exists so the mDNS stack is your choice rather than something the library imposes on you.

§Why you might replace it
  • You already run a system responder. On a typical Linux host avahi-daemon (or systemd-resolved) already owns UDP 5353. A second in-process responder is a second cache, a second set of probes, and a second opinion about what is on the network. Delegating to the daemon you already run removes that whole class of disagreement.
  • You want the OS-native stack. Bonjour on macOS, or a platform/embedded resolver that is better placed than we are to know about interface changes, sleep/wake, and roaming.
  • You are testing. A deterministic test double lets you drive resolution outcomes — a node that never appears, one that appears late, one that resolves to a fixed loopback address — without any real network.
§What your implementation is responsible for

Implement matter_transport::Discovery; its own documentation is the contract. In short: publish/unpublish advertise and withdraw our services, and querypoll_resultsstop_query is a browse whose records you buffer per handle and hand over on each drain. Read the notes on query and stop_query about handle lifetime before you start — a handle that is never stopped keeps costing resources.

The trait may also grow methods that carry a default implementation, so that adding one does not break existing implementors. Your type keeps compiling when that happens, but it silently takes the generic default until you override it — and a default is by definition the unrefined path (for instance, a fallback that browses every operational record rather than a narrowed subset). When you upgrade, check the trait for defaulted methods worth overriding.

§Scope: this covers the controller’s own resolution, not the servers

The discovery you pass here is owned by the controller’s actor task and is what every client operation resolves through — connecting to a node, commissioning, resubscribing.

It is not used by the self-hosted server entry points (listen_for_checkin_once, the ota feature’s serve_ota, and the unstable-provider feature’s serve_provider_once). Each of those runs off the actor on its own socket and needs a Discovery it exclusively owns for the duration of the call, which a single value moved into the actor cannot provide; they each construct their own MdnsSdDiscovery and use it only to publish and withdraw one operational record. So if you supply an Avahi-backed implementation and then serve OTA, your backend does the resolving while that record is still advertised through mdns-sd. If that matters to you, say so on issue #113 — closing the gap means taking a discovery factory here rather than a value, and that is worth doing on demand rather than on speculation.

§Example
let controller = MatterController::builder(store)
    .discovery(my_discovery)
    .build()
    .await?;
Source

pub async fn build(self) -> Result<MatterController, Error>

Bind the socket + discovery, load persisted state, and spawn the actor.

Uses the discovery supplied to Self::discovery, or starts the default MdnsSdDiscovery if none was.

§Errors

Error::Store / Error::Snapshot on load failure, or Error::Operational if the socket / mDNS cannot start.

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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, <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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more