[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABm2a9c92FHGSHbg98B8UjPNF_=JNCV7_Pe3CambvSm2vxiBcw@mail.gmail.com>
Date: Mon, 17 Mar 2025 20:14:52 -0300
From: Christian <christiansantoslima21@...il.com>
To: Benno Lossin <benno.lossin@...ton.me>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, ~lkcamp/patches@...ts.sr.ht,
richard120310@...il.com
Subject: Re: [PATCH v4] Add methods for FromBytes trait.
Hi, Benno.
> It usually is a good idea to include a changelog and a link to any prior
> versions after this `---`. It won't be included in the final commit
> message, but help reviewers and others keep track of this series.
Yeah, my bad. I forgot.
> I think this section should go before the `Safety` section.
I followed this section:
https://docs.kernel.org/rust/coding-guidelines.html#code-documentation,
but no problem, I'll change.
> Why is this trait becoming safe?
I thought that if we change to a Result and get the Err case, it's not
a problem to be safe.
> IMO it makes more sense for the return type to be `Option<&Self>`.
I agree. I'll change.
> This must also require that `Self: AsBytes`, since otherwise the user
> could write padding bytes into the original slice.
Did you mean `ToBytes`? Should I create another patch with an empty trait, e.g
```
unsafe trait ToBytes {}
```
or create the trait and its methods?
> Also the parameter name `mut_slice_of_bytes` is a bit long, how about
> `bytes`?
I liked it, I'll change to `bytes` and `bytes_mut`
> What is this safety comment for?
Idk if I should create another safety comment or just continue. In
this case, I choose the first and submit the patch. So how should I
proceed?
Thanks,
Christian
Powered by blists - more mailing lists