cycle_ptr 0.1.0

Smart pointers, with cycles
//! Traits for linked-list.
use crate::list::linked_list::state::ListEntry;

/// Elements of a list must provide a [ListEntry].
///
/// `Tag` is used to differentiate between different lists.
pub(crate) trait ListElement<Tag> {
    /// Type of the elements.
    type Type: ?Sized;

    /// Retrieve [ListEntry] for reading.
    fn get_entry(&self) -> &ListEntry<Self::Type>;
    /// Retrieve [ListEntry] for mutating.
    #[allow(
        clippy::mut_from_ref,
        reason = "List elements are always shared, but we require write access to the list entry regardless. So this must be a mutable return value."
    )]
    fn get_entry_mut(&self) -> &mut ListEntry<Self::Type>;
}