[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABm2a9fQOMvg4Yjqz2-ba=1HwdXiu_Ep=Jsqz--69Vpec+iRXw@mail.gmail.com>
Date: Mon, 25 Aug 2025 16:51:36 -0300
From: Christian <christiansantoslima21@...il.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: 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>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, ~lkcamp/patches@...ts.sr.ht,
richard120310@...il.com
Subject: Re: [PATCH v10] rust: transmute: Add methods for FromBytes trait
Hi, Miguel.
> > Link: https://github.com/Rust-for-Linux/linux/issues/1119
> > Suggested-by: Alexandre Courbot <acourbot@...dia.com>
>
> Please add a link to the original suggestion if possible. If it is the
> link above, then the tags should be in the opposite order.
>
> Did Benno and Alexandre both suggest it?
Benno suggested the link to github in the issue there. Alexandre
helped in most of the design. It was a mistake by my part not to
specify that. Even if it's good, put you too as suggested-by, because
the idea of using `is_aligned` was yours. Maybe Alexandre can put it
there?
If I understand correctly, should be:
Suggested-by: Benno Lossin <benno.lossin@...ton.me>,
Link: https://github.com/Rust-for-Linux/linux/issues/1119
Suggested-by: Alexandre Courbot <acourbot@...dia.com>
Link: https://lore.kernel.org/rust-for-linux/DC5INTQKY0EX.1T4HD6OU8C4PI@nvidia.com/
Suggested-by: Miguel Ojeda <ojeda@...nel.org>
Link: https://lore.kernel.org/rust-for-linux/CANiq72mnxRquFmjoJemb=3LSq+ZdUfs9J+HXTwM6AavprsVNUg@mail.gmail.com/
> > +/// fn test() -> Option<()> {
> > +/// let raw = [1, 2, 3, 4];
> > +///
> > +/// let result = u32::from_bytes(&raw)?;
> > +///
> > +/// #[cfg(target_endian = "little")]
> > +/// assert_eq!(*result, 0x4030201);
> > +///
> > +/// #[cfg(target_endian = "big")]
> > +/// assert_eq!(*result, 0x1020304);
> > +///
> > +/// Some(())
> > +/// }
>
> Should the function be called? Otherwise, we are only build-testing this.
>
> Should we just remove the function and to it directly at the top-level?
I think just calling `test()` is good, but it's an aesthetic preference.
Thanks,
Christian
Powered by blists - more mailing lists