Trait tokio::util::sharded_list::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.

Object Safety§

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.)