The existing two examples (onoff_light and the upcoming onoff_light_bt) have a lot of code duplication which will only grow if more examples are coming:
Device attestation code
Move to a shared common/dev_att.rs file
Possibly use include_bytes! rather than encoding the certificates in static Rust slices
Detection of network configuration (ipv4 and ipv6)
Move to a common utility?
Running mDNS, persister and others
Move to a common utility, if possible?
On the other hand, examples are supposed to be straightforward, even if that means a bit of a code duplication. So beyond moving the device attestation to a common file (which is non-controversial), we have to see what else makes sense to unify.
Examples also tend to be very verbose currently, and that's because rs-matter is more of a toolkit rather than a ready-to-use solution.
Perhaps we need something like rs-matter-stack in future as a sibling crate to the existing ones? For one, it tends to produce much smaller examples, as that crate is more oppinionated.
The existing two examples (
onoff_light
and the upcomingonoff_light_bt
) have a lot of code duplication which will only grow if more examples are coming:common/dev_att.rs
fileinclude_bytes!
rather than encoding the certificates in static Rust slicesOn the other hand, examples are supposed to be straightforward, even if that means a bit of a code duplication. So beyond moving the device attestation to a common file (which is non-controversial), we have to see what else makes sense to unify.
Examples also tend to be very verbose currently, and that's because
rs-matter
is more of a toolkit rather than a ready-to-use solution.Perhaps we need something like
rs-matter-stack
in future as a sibling crate to the existing ones? For one, it tends to produce much smaller examples, as that crate is more oppinionated.