Messages in this thread | | | Date | Thu, 25 Apr 2024 17:20:18 +0100 | From | Gary Guo <> | Subject | Re: [PATCH v6 4/4] rust: add abstraction for `struct page` |
| |
On Thu, 18 Apr 2024 15:56:11 -0700 Boqun Feng <boqun.feng@gmail.com> wrote:
> Hmm.. here is the thing, having `&UnsafeCell<[u8]>` means having a `*mut > [u8]>`, and it should always be safe to get a "length" of `*mut [u8]`, > right? I haven't found any method doing that, but the length should be > just a part of fat pointer, so I think getting that is a defined > behavior. But maybe I'm missing something.
You can just use `unsafe_cell.get().len()`. `len` method exists on raw slice pointers, gated by the `slice_ptr_len` feature, which will be stable in 1.79.0.
Best, Gary
| |