tokio::util::sharded_list

Trait ShardedListItem

Source
pub(crate) unsafe trait ShardedListItem: Link {
    // Required method
    unsafe fn get_shard_id(target: NonNull<Self::Target>) -> usize;
}
Expand description

Determines which linked list an item should be stored in.

§Safety

Implementations must guarantee that the id of an item does not change from call to call.

Required Methods§

Source

unsafe fn get_shard_id(target: NonNull<Self::Target>) -> usize

§Safety

The provided pointer must point at a valid list item.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S> ShardedListItem for Task<S>

§Safety

The id of a task is never changed after creation of the task, so the return value of get_shard_id will not change. (The cast may throw away the upper 32 bits of the task id, but the shard id still won’t change from call to call.)