Skip to content

Add PeripheralID trait and use it in api#457

Open
ColonelThirtyTwo wants to merge 1 commit intodeviceplug:devfrom
ColonelThirtyTwo:peripheral-id-trait
Open

Add PeripheralID trait and use it in api#457
ColonelThirtyTwo wants to merge 1 commit intodeviceplug:devfrom
ColonelThirtyTwo:peripheral-id-trait

Conversation

@ColonelThirtyTwo
Copy link
Copy Markdown

Currently, the api submodule uses one type from the platform submodule: PeripheralID. If an external crate wanted to implement the API for a custom backend, they would be stuck with the platform's opaque PeripheralID and be unable to use their own.

With this patch, the peripheral ID type is now an associated type of the Peripheral. CentralEvent also now has a generic argument for the peripheral ID type.

This adds a PeripheralID trait, which is mostly just to combine the supertraits like Clone, Send, Sync, etc into a more usable trait.

Currently, the `api` submodule uses one type from the `platform`
submodule: `PeripheralID`. If an external crate wanted to implement the
API for a custom backend, they would be stuck with the platform's opaque
`PeripheralID` and be unable to use their own.

With this patch, the peripheral ID type is now an associated type of the
`Peripheral`. `CentralEvent` also now has a generic argument for the
peripheral ID type.

This adds a `PeripheralID` trait, which is mostly just to combine the
supertraits like Clone, Send, Sync, etc into a more usable trait.
@qwandor qwandor changed the base branch from master to dev March 23, 2026 23:24
@ColonelThirtyTwo
Copy link
Copy Markdown
Author

Check failures are from clippy issues with the existing Android code.

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

Successfully merging this pull request may close these issues.

1 participant