Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Examples] Remove code duplication #196

Open
ivmarkov opened this issue Jun 25, 2024 · 0 comments
Open

[Examples] Remove code duplication #196

ivmarkov opened this issue Jun 25, 2024 · 0 comments

Comments

@ivmarkov
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant