Re: [PATCH 3/9] rust: list: add struct with prev/next pointers

From: Benno Lossin
Date: Wed Apr 03 2024 - 11:57:36 EST


On 02.04.24 14:17, Alice Ryhl wrote:
> +/// Implemented by types where a [`ListArc<Self>`] can be inserted into a `List`.
> +///
> +/// # Safety
> +///
> +/// Implementers must ensure that they provide the guarantees documented on the three methods
> +/// below.
> +///
> +/// [`ListArc<Self>`]: ListArc
> +pub unsafe trait ListItem<const ID: u64 = 0>: ListArcSafe<ID> {
> + /// Views the [`ListLinks`] for this value.
> + ///
> + /// # Guarantees
> + ///
> + /// * If there is a currently active call to `prepare_to_insert`, then this returns the same
> + /// pointer as the one returned by the currently active call to `prepare_to_insert`.

I was a bit confused by the term "active call to `prepare_to_insert`",
since I thought that the function would need to be executed at this
moment. I inferred from below that you mean by this that there has been
a `prepare_to_insert` call, but not yet a corresponding `post_remove`
call.
I did not yet find a better way to phrase this.

I like putting the guarantees on the functions very much.

--
Cheers,
Benno