project-chip / rs-matter

Rust implementation of the Matter protocol. Status: Experimental
Apache License 2.0
303 stars 43 forks source link

[Examples] Remove code duplication #196

Open ivmarkov opened 1 month ago

ivmarkov commented 1 month ago

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:

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.