这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@qwandor-google
Copy link
Collaborator

Just moving things around and adding a few doc comments.

/// Decode the readings from the raw bytes of the Bluetooth characteristic value, if they are
/// valid.
/// Returns `None` if the value is not valid.
pub fn decode(value: &[u8]) -> Option<Readings> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

long-term, I would be tempted to implement https://doc.rust-lang.org/std/convert/trait.TryFrom.html , and then use let readings = value.try_into().ok()? in the one place where it's used.

For now, I don't think that consumers will ever have &[u8] in their hand, so maybe pub(crate) and leave everything else as-is?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done the latter.

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.

4 participants