Skip to content

Implement Box, Rc and Arc blanket trait impls for all rs-matter pub traits #323

@ivmarkov

Description

@ivmarkov

While rs-matter is no_std and no-alloc, the user app might not be and might be using the allocator.

Therefore, it might be useful to have (behind a #[cfg(feature = "alloc")]) blanket trait impls of all our public traits for the alloc types:

  • impl<T> MyTrait for Box<T> where T: MyTrait { ... } - this for all traits
  • impl<T> MyTrait for Rc<T> where T: MyTrait { ... } - this for traits which have only &self methods
  • impl<T> MyTrait for Arc<T> where T: MyTrait { ... } - this for traits which have only &self methods; needs to additionally be protected to only execute on targets that do have core::sync::atomic
  • impl<T> MyTrait for portable_atomic::Arc<T> where T: MyTrait { ... } - this for traits which have only &self methods; and only if we decide to keep the portable-atomic dependency around; perhaps behind a #[cfg(feature = "portable-atomic")]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions