-
Notifications
You must be signed in to change notification settings - Fork 77
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
Document TryFromBytes
#974
Conversation
a67df38
to
3460831
Compare
src/lib.rs
Outdated
/// | ||
/// WARNING: Do not implement this trait yourself! Instead, use | ||
/// `#[derive(TryFromBytes)]`. | ||
/// This derive synthesizes the runtime checks required to check if a sequence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// This derive synthesizes the runtime checks required to check if a sequence | |
/// This derive synthesizes the runtime checks required to check whether a sequence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/lib.rs
Outdated
/// Types for which some bit patterns are valid. | ||
/// | ||
/// A memory region of the appropriate length which contains initialized bytes | ||
/// can be viewed as a `TryFromBytes` type so long as the runtime value of bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// can be viewed as a `TryFromBytes` type so long as the runtime value of bytes | |
/// can be viewed as a `TryFromBytes` type so long as the runtime value of those bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/lib.rs
Outdated
/// A memory region of the appropriate length which contains initialized bytes | ||
/// can be viewed as a `TryFromBytes` type so long as the runtime value of bytes | ||
/// correspond to a [*valid instance*] of that type. For example, [`bool`] is | ||
/// `TryFromBytes`; zerocopy can transmute a [`bool`] into a [`u8`] so long as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// `TryFromBytes`; zerocopy can transmute a [`bool`] into a [`u8`] so long as | |
/// `TryFromBytes`; zerocopy can transmute a [`u8`] into a [`bool`] so long as |
Also, this isn't technically true in our API (right now). We don't have try_transmute!
, so we can't actually do this. Maybe say something like "zerocopy can transmute a [u8]
into a bool
..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
3460831
to
15e6e02
Compare
Makes progress towards #5.
15e6e02
to
611361c
Compare
Makes progress towards #5.