-
Notifications
You must be signed in to change notification settings - Fork 434
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
Add FromBytes::from_bytes
and AsBytes::as_bytes
#1119
Comments
|
Oh yeah that is true, good catch! |
Hi, can I take this issue? |
sure! |
@y86-dev Do you mind explain the bjorn3 commentary? English isn't my main language and translating is being confuse to me. When he says "bound" is something like bound check? I mean, put a limit e.g |
An example of a bound would be: trait Foo {
fn bar(&self) where Self: Baz;
} Here the |
Hi, I again! Since we use ToBytes with where clause, maybe we can just return |
Add implementation and documentation for FromBytes trait. Add new feature block in order to allow using ToBytes and bound to from_bytes_mut function. Link: Rust-for-Linux#1119 Signed-off-by: Christian dos Santos de Lima <[email protected]>
Add implementation and documentation for FromBytes trait. Add new feature block in order to allow using ToBytes and bound to from_bytes_mut function. I'm adding this feature because is possible create a value with disallowed bit pattern and as_byte_mut could create such value by mutating the array and acessing the original value. So adding ToBytes this can be avoided. Link: Rust-for-Linux#1119 Signed-off-by: Christian dos Santos de Lima <[email protected]>
Hi, still working on it! I needed a break because my uni. Getting back to work now. |
FromBytes::from_bytes[_mut]
:unsafe
function that converts a (mutable) slice of bytes into a (mutable) reference toSelf
AsBytes::as_bytes[_mut]
: function that converts a (mutable) reference toSelf
into a (mutable) slicePlease also add examples to the documentation of the functions. These additions should be two patches.
This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a
Suggested-by: tag
and aLink:
tag to this issue. Please see https://rust-for-linux.com/contributing for details.Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.
The text was updated successfully, but these errors were encountered: