id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio:tokio/src/util/linked_list.rs:20 | .map(|i| match i % 3u8 {
0 => Op::Push,
1 => Op::Pop,
2 => Op::Remove((i / 3u8) as usize),
_ => unreachable!(),
})
.collect::<Vec<_>>();
let mut ll = LinkedList::<&Entry, <&Entry as Link>::Target>::new();
let mut re... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/linked_list.rs | 761 | 808 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:1 | #![cfg_attr(not(feature = "full"), allow(dead_code))]
//! An intrusive double linked list of data.
//!
//! The data structure supports tracking pinned nodes. Most of the data
//! structure's APIs are `unsafe` as they require the caller to ensure the
//! specified node is actually contained by the list.
use core::cell... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:2 | /// other words, when a node is inserted, the value will not be moved as long as
/// it is stored in the list.
pub(crate) unsafe trait Link {
/// Handle to the list entry.
///
/// This is usually a pointer-ish type.
type Handle;
/// Node type.
type Target;
/// Convert the handle to a raw p... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:3 | /// hence be given the `noalias` attribute if we were to do such an access. As
/// an alternative to accessing the fields directly, the `Pointers` type
/// provides getters and setters for the two fields, and those are implemented
/// using `ptr`-specific methods which avoids the creation of intermediate
/// references... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:4 | let val = ManuallyDrop::new(val);
let ptr = L::as_raw(&val);
assert_ne!(self.head, Some(ptr));
unsafe {
L::pointers(ptr).as_mut().set_next(self.head);
L::pointers(ptr).as_mut().set_prev(None);
if let Some(head) = self.head {
L::pointers(head).... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:5 | /// empty.
pub(crate) fn pop_back(&mut self) -> Option<L::Handle> {
unsafe {
let last = self.tail?;
self.tail = L::pointers(last).as_ref().get_prev();
if let Some(prev) = L::pointers(last).as_ref().get_prev() {
L::pointers(prev).as_mut().set_next(None);
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:6 | if let Some(prev) = L::pointers(node).as_ref().get_prev() {
debug_assert_eq!(L::pointers(prev).as_ref().get_next(), Some(node));
L::pointers(prev)
.as_mut()
.set_next(L::pointers(node).as_ref().get_next());
} else {
if self.head != Some(node) {... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:7 | }
}
#[cfg(any(
feature = "fs",
feature = "rt",
all(unix, feature = "process"),
feature = "signal",
feature = "sync",
))]
impl<L: Link> LinkedList<L, L::Target> {
pub(crate) fn last(&self) -> Option<&L::Target> {
let tail = self.tail.as_ref()?;
unsafe { Some(&*tail.as_ptr()) }
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:8 | filter,
list: self,
}
}
}
impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
where
T: Link,
F: FnMut(&T::Target) -> bool,
{
type Item = T::Handle;
fn next(&mut self) -> Option<Self::Item> {
while let Some(curr) = self.curr ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:9 | f(&handle);
next = T::pointers(curr).as_ref().get_next();
}
}
}
}
}
// ===== impl GuardedLinkedList =====
feature! {
#![any(
feature = "process",
feature = "sync",
feature = "rt",
feature = "signal",
)]
/// An int... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:10 | unsafe {
if let Some(head) = self.head {
debug_assert!(L::pointers(head).as_ref().get_prev().is_none());
L::pointers(head).as_mut().set_prev(Some(guard));
L::pointers(guard).as_mut().set_next(Some(head));
// The list is not... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:11 | /// empty.
pub(crate) fn pop_back(&mut self) -> Option<L::Handle> {
unsafe {
let last = self.tail()?;
let before_last = L::pointers(last).as_ref().get_prev().unwrap();
L::pointers(self.guard).as_mut().set_prev(Some(before_last));
L::po... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:12 | fn set_prev(&mut self, value: Option<NonNull<T>>) {
// SAFETY: Field is accessed mutably through a mutable reference.
unsafe {
ptr::addr_of_mut!((*self.inner.get()).prev).write(value);
}
}
fn set_next(&mut self, value: Option<NonNull<T>>) {
// SAFETY: Field is accesse... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:13 | unsafe impl<'a> Link for &'a Entry {
type Handle = Pin<&'a Entry>;
type Target = Entry;
fn as_raw(handle: &Pin<&'_ Entry>) -> NonNull<Entry> {
NonNull::from(handle.get_ref())
}
unsafe fn from_raw(ptr: NonNull<Entry>) -> Pin<&'a Entry> {
Pin::new_unchecke... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:14 | entries: &[Pin<&'a Entry>],
) {
for entry in entries.iter() {
list.push_front(*entry);
}
}
#[cfg(test)]
macro_rules! assert_clean {
($e:ident) => {{
assert!($e.pointers.get_next().is_none());
assert!($e.pointers.get_prev().is_none());
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:15 | list.push_front(c.as_ref());
let items: Vec<i32> = collect_list(&mut list);
assert_eq!([5, 7, 31].to_vec(), items);
assert!(list.is_empty());
}
#[test]
fn push_pop_push_pop() {
let a = entry(5);
let b = entry(7);
let mut list = LinkedList::<&Entry, <&Entry... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:16 | push_all(&mut list, &[c.as_ref(), b.as_ref(), a.as_ref()]);
assert!(list.remove(ptr(&a)).is_some());
assert_clean!(a);
// `a` should be no longer there and can't be removed twice
assert!(list.remove(ptr(&a)).is_none());
assert!(!list.is_empty());
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:17 | push_all(&mut list, &[c.as_ref(), b.as_ref(), a.as_ref()]);
assert!(list.remove(ptr(&b)).is_some());
assert_clean!(b);
assert_ptr_eq!(c, a.pointers.get_next());
assert_ptr_eq!(a, c.pointers.get_prev());
let items = collect_list(&mut list);
asser... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:18 | // a should be no longer there and can't be removed twice
assert!(list.remove(ptr(&a)).is_none());
assert_ptr_eq!(b, list.head);
assert_ptr_eq!(b, list.tail);
assert!(b.pointers.get_next().is_none());
assert!(b.pointers.get_prev().is_none());
le... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:19 | assert_clean!(a);
assert!(list.head.is_none());
assert!(list.tail.is_none());
let items = collect_list(&mut list);
assert!(items.is_empty());
}
unsafe {
// Remove missing
let mut list = LinkedList::<&Entry, <&Entry as Link>::Targe... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:20 | let mut reference = VecDeque::new();
let entries: Vec<_> = (0..ops.len()).map(|i| entry(i as i32)).collect();
for (i, op) in ops.iter().enumerate() {
match op {
Op::Push => {
reference.push_front(i as i32);
assert_eq!(entries[i].val, ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 47210a8e6eeb82b51aa778074fdc4d757b953b8c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47210a8e6eeb82b51aa778074fdc4d757b953b8c/tokio/src/util/linked_list.rs | 761 | 799 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:8 | filter,
list: self,
}
}
}
impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
where
T: Link,
F: FnMut(&T::Target) -> bool,
{
type Item = T::Handle;
fn next(&mut self) -> Option<Self::Item> {
while let Some(curr) = self.curr ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:9 | f(&handle);
next = T::pointers(curr).as_ref().get_next();
}
}
}
}
}
// ===== impl GuardedLinkedList =====
feature! {
#![any(
feature = "process",
feature = "sync",
feature = "rt",
feature = "signal",
feature = "tim... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:10 | let guard = L::as_raw(&guard_handle);
unsafe {
if let Some(head) = self.head {
debug_assert!(L::pointers(head).as_ref().get_prev().is_none());
L::pointers(head).as_mut().set_prev(Some(guard));
L::pointers(guard).as_mut().set_next(S... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:11 | /// Removes the last element from a list and returns it, or None if it is
/// empty.
pub(crate) fn pop_back(&mut self) -> Option<L::Handle> {
unsafe {
let last = self.tail()?;
let before_last = L::pointers(last).as_ref().get_prev().unwrap();
L... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:12 | }
fn set_prev(&mut self, value: Option<NonNull<T>>) {
// SAFETY: Field is accessed mutably through a mutable reference.
unsafe {
ptr::addr_of_mut!((*self.inner.get()).prev).write(value);
}
}
fn set_next(&mut self, value: Option<NonNull<T>>) {
// SAFETY: Field is ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:13 | unsafe impl<'a> Link for &'a Entry {
type Handle = Pin<&'a Entry>;
type Target = Entry;
fn as_raw(handle: &Pin<&'_ Entry>) -> NonNull<Entry> {
NonNull::from(handle.get_ref())
}
unsafe fn from_raw(ptr: NonNull<Entry>) -> Pin<&'a Entry> {
Pin::new_unchecke... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:14 | list: &mut LinkedList<&'a Entry, <&'_ Entry as Link>::Target>,
entries: &[Pin<&'a Entry>],
) {
for entry in entries.iter() {
list.push_front(*entry);
}
}
#[cfg(test)]
macro_rules! assert_clean {
($e:ident) => {{
assert!($e.pointers.get_next().is_n... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:15 | list.push_front(b.as_ref());
list.push_front(c.as_ref());
let items: Vec<i32> = collect_list(&mut list);
assert_eq!([5, 7, 31].to_vec(), items);
assert!(list.is_empty());
}
#[test]
fn push_pop_push_pop() {
let a = entry(5);
let b = entry(7);
let mu... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:17 | let mut list = LinkedList::new();
push_all(&mut list, &[c.as_ref(), b.as_ref(), a.as_ref()]);
assert!(list.remove(ptr(&b)).is_some());
assert_clean!(b);
assert_ptr_eq!(c, a.pointers.get_next());
assert_ptr_eq!(a, c.pointers.get_prev());
let ite... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:18 | // a should be no longer there and can't be removed twice
assert!(list.remove(ptr(&a)).is_none());
assert_ptr_eq!(b, list.head);
assert_ptr_eq!(b, list.tail);
assert!(b.pointers.get_next().is_none());
assert!(b.pointers.get_prev().is_none());
le... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:19 | assert!(list.remove(ptr(&a)).is_some());
assert_clean!(a);
assert!(list.head.is_none());
assert!(list.tail.is_none());
let items = collect_list(&mut list);
assert!(items.is_empty());
}
unsafe {
// Remove missing
let mu... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:20 | let mut ll = LinkedList::<&Entry, <&Entry as Link>::Target>::new();
let mut reference = VecDeque::new();
let entries: Vec<_> = (0..ops.len()).map(|i| entry(i as i32)).collect();
for (i, op) in ops.iter().enumerate() {
match op {
Op::Push => {
ref... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 8480a180e6ffdd0ec0ec213a9bebcda2445fc541 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8480a180e6ffdd0ec0ec213a9bebcda2445fc541/tokio/src/util/linked_list.rs | 761 | 800 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:9 | f(&handle);
next = T::pointers(curr).as_ref().get_next();
}
}
}
}
}
// ===== impl GuardedLinkedList =====
feature! {
#![any(
feature = "process",
feature = "sync",
feature = "rt",
feature = "signal",
)]
/// An int... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 9e00b266e08d263c497dc9de57d9acbc049ae69b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9e00b266e08d263c497dc9de57d9acbc049ae69b/tokio/src/util/linked_list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:3 | /// hence be given the `noalias` attribute if we were to do such an access. As
/// an alternative to accessing the fields directly, the `Pointers` type
/// provides getters and setters for the two fields, and those are implemented
/// using `ptr`-specific methods which avoids the creation of intermediate
/// references... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:4 | let val = ManuallyDrop::new(val);
let ptr = L::as_raw(&val);
assert_ne!(self.head, Some(ptr));
unsafe {
L::pointers(ptr).as_mut().set_next(self.head);
L::pointers(ptr).as_mut().set_prev(None);
if let Some(head) = self.head {
L::pointers(head).... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:5 | pub(crate) fn is_empty(&self) -> bool {
if self.head.is_some() {
return false;
}
assert!(self.tail.is_none());
true
}
/// Removes the specified node from the list
///
/// # Safety
///
/// The caller **must** ensure that exactly one of the following i... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:6 | if self.tail != Some(node) {
return None;
}
self.tail = L::pointers(node).as_ref().get_prev();
}
L::pointers(node).as_mut().set_next(None);
L::pointers(node).as_mut().set_prev(None);
Some(L::from_raw(node))
}
}
impl<L: Link> fmt::Debug for ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:7 | }
}
// ===== impl DrainFilter =====
cfg_io_driver_impl! {
pub(crate) struct DrainFilter<'a, T: Link, F> {
list: &'a mut LinkedList<T, T::Target>,
filter: F,
curr: Option<NonNull<T::Target>>,
}
impl<T: Link> LinkedList<T, T::Target> {
pub(crate) fn drain_filter<F>(&mut self... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:8 | return unsafe { self.list.remove(curr) };
}
}
None
}
}
}
cfg_taskdump! {
impl<T: Link> LinkedList<T, T::Target> {
pub(crate) fn for_each<F>(&mut self, mut f: F)
where
F: FnMut(&T::Handle),
{
let mut next = self.hea... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:9 | /// It means that the list is circular and every pointer of a node from
/// the list is not `None`, including pointers from the guard node.
///
/// If a list is empty, then both pointers of the guard node are pointing
/// at the guard node itself.
pub(crate) struct GuardedLinkedList<L, T> {
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:10 | }
}
impl<L: Link> GuardedLinkedList<L, L::Target> {
fn tail(&self) -> Option<NonNull<L::Target>> {
let tail_ptr = unsafe {
L::pointers(self.guard).as_ref().get_prev().unwrap()
};
// Compare the tail pointer with the address of the guard node itself.
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:11 | impl<T> Pointers<T> {
/// Create a new set of empty pointers
pub(crate) fn new() -> Pointers<T> {
Pointers {
inner: UnsafeCell::new(PointersInner {
prev: None,
next: None,
_pin: PhantomPinned,
}),
}
}
pub(crate) fn ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:12 | .field("prev", &prev)
.field("next", &next)
.finish()
}
}
#[cfg(any(test, fuzzing))]
#[cfg(not(loom))]
pub(crate) mod tests {
use super::*;
use std::pin::Pin;
#[derive(Debug)]
#[repr(C)]
struct Entry {
pointers: Pointers<Entry>,
val: i32,
}
uns... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:13 | val,
})
}
fn ptr(r: &Pin<Box<Entry>>) -> NonNull<Entry> {
r.as_ref().get_ref().into()
}
fn collect_list(list: &mut LinkedList<&'_ Entry, <&'_ Entry as Link>::Target>) -> Vec<i32> {
let mut ret = vec![];
while let Some(entry) = list.pop_back() {
ret.push(ent... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:14 | }};
}
#[test]
fn const_new() {
const _: LinkedList<&Entry, <&Entry as Link>::Target> = LinkedList::new();
}
#[test]
fn push_and_drain() {
let a = entry(5);
let b = entry(7);
let c = entry(31);
let mut list = LinkedList::new();
assert!(list.is_em... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:15 | list.push_front(b.as_ref());
let entry = list.pop_back().unwrap();
assert_eq!(7, entry.val);
assert!(list.is_empty());
assert!(list.pop_back().is_none());
}
#[test]
fn remove_by_address() {
let a = entry(5);
let b = entry(7);
let c = entry(31);
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:16 | unsafe {
// Remove middle
let mut list = LinkedList::new();
push_all(&mut list, &[c.as_ref(), b.as_ref(), a.as_ref()]);
assert!(list.remove(ptr(&a)).is_some());
assert_clean!(a);
assert_ptr_eq!(b, list.head);
assert_ptr_eq!(c, b.poin... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:17 | assert!(list.remove(ptr(&c)).is_some());
assert_clean!(c);
assert!(b.pointers.get_next().is_none());
assert_ptr_eq!(b, list.tail);
let items = collect_list(&mut list);
assert_eq!([7, 5].to_vec(), items);
}
unsafe {
// Remove firs... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:18 | assert_clean!(b);
assert_ptr_eq!(a, list.head);
assert_ptr_eq!(a, list.tail);
assert!(a.pointers.get_next().is_none());
assert!(a.pointers.get_prev().is_none());
let items = collect_list(&mut list);
assert_eq!([5].to_vec(), items);
}
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:19 | #[cfg(fuzzing)]
pub fn fuzz_linked_list(ops: &[u8]) {
enum Op {
Push,
Pop,
Remove(usize),
}
use std::collections::VecDeque;
let ops = ops
.iter()
.map(|i| match i % 3u8 {
0 => Op::Push,
1 => ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 721 | 779 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:20 | }
Op::Remove(n) => {
if reference.is_empty() {
assert!(ll.is_empty());
continue;
}
let idx = n % reference.len();
let expect = reference.remove(idx).unwrap();
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ced7739f69498a702640211bfbaeddb7e864b3d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ced7739f69498a702640211bfbaeddb7e864b3d2/tokio/src/util/linked_list.rs | 761 | 779 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:2 | /// other words, when a node is inserted, the value will not be moved as long as
/// it is stored in the list.
pub(crate) unsafe trait Link {
/// Handle to the list entry.
///
/// This is usually a pointer-ish type.
type Handle;
/// Node type.
type Target;
/// Convert the handle to a raw p... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:3 | /// hence be given the `noalias` attribute if we were to do such an access.
/// As an alternative to accessing the fields directly, the `Pointers` type
/// provides getters and setters for the two fields, and those are implemented
/// using raw pointer casts and offsets, which is valid since the struct is
/// #[repr(C)... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:4 | }
}
impl<L: Link> LinkedList<L, L::Target> {
/// Adds an element first in the list.
pub(crate) fn push_front(&mut self, val: L::Handle) {
// The value should not be dropped, it is being inserted into the list
let val = ManuallyDrop::new(val);
let ptr = L::as_raw(&val);
assert_ne... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:5 | L::pointers(last).as_mut().set_next(None);
Some(L::from_raw(last))
}
}
/// Returns whether the linked list does not contain any node
pub(crate) fn is_empty(&self) -> bool {
if self.head.is_some() {
return false;
}
assert!(self.tail.is_none());
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:6 | if let Some(next) = L::pointers(node).as_ref().get_next() {
debug_assert_eq!(L::pointers(next).as_ref().get_prev(), Some(node));
L::pointers(next)
.as_mut()
.set_prev(L::pointers(node).as_ref().get_prev());
} else {
// This might be the last it... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:7 | unsafe { Some(&*tail.as_ptr()) }
}
}
impl<L: Link> Default for LinkedList<L, L::Target> {
fn default() -> Self {
Self::new()
}
}
// ===== impl DrainFilter =====
cfg_io_driver_impl! {
pub(crate) struct DrainFilter<'a, T: Link, F> {
list: &'a mut LinkedList<T, T::Target>,
filter... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:8 | fn next(&mut self) -> Option<Self::Item> {
while let Some(curr) = self.curr {
// safety: the pointer references data contained by the list
self.curr = unsafe { T::pointers(curr).as_ref() }.get_next();
// safety: the value is still owned by the linked list.
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:9 | feature = "sync",
feature = "rt",
feature = "signal",
)]
/// An intrusive linked list, but instead of keeping pointers to the head
/// and tail nodes, it uses a special guard node linked with those nodes.
/// It means that the list is circular and every pointer of a node from
/// th... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:10 | // The list is empty.
L::pointers(guard).as_mut().set_prev(Some(guard));
L::pointers(guard).as_mut().set_next(Some(guard));
}
}
GuardedLinkedList { guard, _marker: PhantomData }
}
}
impl<L: Link> GuardedLinkedList<L, L::Ta... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:11 | }
}
}
}
// ===== impl Pointers =====
impl<T> Pointers<T> {
/// Create a new set of empty pointers
pub(crate) fn new() -> Pointers<T> {
Pointers {
inner: UnsafeCell::new(PointersInner {
prev: None,
next: None,
_pin: PhantomPinned,
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:12 | let inner = self.inner.get();
let prev = inner as *mut Option<NonNull<T>>;
ptr::write(prev, value);
}
}
fn set_next(&mut self, value: Option<NonNull<T>>) {
// SAFETY: next is the second field in PointersInner, which is #[repr(C)].
unsafe {
let inner = ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/util/linked_list.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:6 | if let Some(next) = L::pointers(node).as_ref().get_next() {
debug_assert_eq!(L::pointers(next).as_ref().get_prev(), Some(node));
L::pointers(next)
.as_mut()
.set_prev(L::pointers(node).as_ref().get_prev());
} else {
// This might be the last it... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:7 | pub(crate) fn new() -> CountedLinkedList<L, L::Target> {
CountedLinkedList {
list: LinkedList::new(),
count: 0,
}
}
pub(crate) fn push_front(&mut self, val: L::Handle) {
self.list.push_front(val);
self.count += 1;
}
pub(crate) fn pop_back(&mut se... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:8 | all(unix, feature = "process"),
feature = "signal",
feature = "sync",
))]
impl<L: Link> LinkedList<L, L::Target> {
pub(crate) fn last(&self) -> Option<&L::Target> {
let tail = self.tail.as_ref()?;
unsafe { Some(&*tail.as_ptr()) }
}
}
impl<L: Link> Default for LinkedList<L, L::Target> {
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:9 | impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
where
T: Link,
F: FnMut(&T::Target) -> bool,
{
type Item = T::Handle;
fn next(&mut self) -> Option<Self::Item> {
while let Some(curr) = self.curr {
// safety: the pointer references data contained by t... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:10 | let mut next = self.head;
while let Some(curr) = next {
unsafe {
let handle = ManuallyDrop::new(T::from_raw(curr));
f(&handle);
next = T::pointers(curr).as_ref().get_next();
}
}
}
}
}
// ===... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:11 | /// with the head and tail nodes. Like with other nodes, you should guarantee
/// that the guard node is pinned in memory.
pub(crate) fn into_guarded(self, guard_handle: L::Handle) -> GuardedLinkedList<L, L::Target> {
// `guard_handle` is a NonNull pointer, we don't have to care about droppi... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:12 | None
}
}
/// Removes the last element from a list and returns it, or None if it is
/// empty.
pub(crate) fn pop_back(&mut self) -> Option<L::Handle> {
unsafe {
let last = self.tail()?;
let before_last = L::pointers(last).as_ref().g... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:13 | let inner = self.inner.get();
let prev = inner as *const Option<NonNull<T>>;
ptr::read(prev)
}
}
pub(crate) fn get_next(&self) -> Option<NonNull<T>> {
// SAFETY: next is the second field in PointersInner, which is #[repr(C)].
unsafe {
let inner = self.... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:14 | .field("next", &next)
.finish()
}
}
#[cfg(any(test, fuzzing))]
#[cfg(not(loom))]
pub(crate) mod tests {
use super::*;
use std::pin::Pin;
#[derive(Debug)]
#[repr(C)]
struct Entry {
pointers: Pointers<Entry>,
val: i32,
}
unsafe impl<'a> Link for &'a Entry {
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:15 | })
}
fn ptr(r: &Pin<Box<Entry>>) -> NonNull<Entry> {
r.as_ref().get_ref().into()
}
fn collect_list(list: &mut LinkedList<&'_ Entry, <&'_ Entry as Link>::Target>) -> Vec<i32> {
let mut ret = vec![];
while let Some(entry) = list.pop_back() {
ret.push(entry.val);
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:16 | }
#[test]
fn const_new() {
const _: LinkedList<&Entry, <&Entry as Link>::Target> = LinkedList::new();
}
#[test]
fn push_and_drain() {
let a = entry(5);
let b = entry(7);
let c = entry(31);
let mut list = LinkedList::new();
assert!(list.is_empty());
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:18 | // Remove middle
let mut list = LinkedList::new();
push_all(&mut list, &[c.as_ref(), b.as_ref(), a.as_ref()]);
assert!(list.remove(ptr(&a)).is_some());
assert_clean!(a);
assert_ptr_eq!(b, list.head);
assert_ptr_eq!(c, b.pointers.get_next());
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:19 | assert_clean!(c);
assert!(b.pointers.get_next().is_none());
assert_ptr_eq!(b, list.tail);
let items = collect_list(&mut list);
assert_eq!([7, 5].to_vec(), items);
}
unsafe {
// Remove first of two
let mut list = LinkedList::new()... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:20 | assert_clean!(b);
assert_ptr_eq!(a, list.head);
assert_ptr_eq!(a, list.tail);
assert!(a.pointers.get_next().is_none());
assert!(a.pointers.get_prev().is_none());
let items = collect_list(&mut list);
assert_eq!([5].to_vec(), items);
}
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:21 | let mut list = CountedLinkedList::<&Entry, <&Entry as Link>::Target>::new();
assert_eq!(0, list.count());
let a = entry(5);
let b = entry(7);
list.push_front(a.as_ref());
list.push_front(b.as_ref());
assert_eq!(2, list.count());
list.pop_back();
assert_e... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:22 | let entries: Vec<_> = (0..ops.len()).map(|i| entry(i as i32)).collect();
for (i, op) in ops.iter().enumerate() {
match op {
Op::Push => {
reference.push_front(i as i32);
assert_eq!(entries[i].val, i as i32);
ll.push_front(... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/util/linked_list.rs | 841 | 878 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:4 | }
}
impl<L: Link> LinkedList<L, L::Target> {
/// Adds an element first in the list.
pub(crate) fn push_front(&mut self, val: L::Handle) {
// The value should not be dropped, it is being inserted into the list
let val = ManuallyDrop::new(val);
let ptr = L::as_raw(&val);
assert_ne... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ec1f52e1d3ab12308243758d297dedbccac1e262 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ec1f52e1d3ab12308243758d297dedbccac1e262/tokio/src/util/linked_list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:8 | all(unix, feature = "process"),
feature = "signal",
feature = "sync",
))]
impl<L: Link> LinkedList<L, L::Target> {
pub(crate) fn last(&self) -> Option<&L::Target> {
let tail = self.tail.as_ref()?;
unsafe { Some(&*tail.as_ptr()) }
}
}
impl<L: Link> Default for LinkedList<L, L::Target> {
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ce23db6bc7c6a2853377db629ca8b761a45e0476 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/util/linked_list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:9 | impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
where
T: Link,
F: FnMut(&mut T::Target) -> bool,
{
type Item = T::Handle;
fn next(&mut self) -> Option<Self::Item> {
while let Some(curr) = self.curr {
// safety: the pointer references data contained ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | ce23db6bc7c6a2853377db629ca8b761a45e0476 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/util/linked_list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:7 | pub(crate) fn new() -> CountedLinkedList<L, L::Target> {
CountedLinkedList {
list: LinkedList::new(),
count: 0,
}
}
pub(crate) fn push_front(&mut self, val: L::Handle) {
self.list.push_front(val);
self.count += 1;
}
pub(crate) fn pop_back(&mut se... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | f478ff4a249b14db2d2cb99900e7894717eaf188 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f478ff4a249b14db2d2cb99900e7894717eaf188/tokio/src/util/linked_list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:8 | all(unix, feature = "process"),
feature = "signal",
feature = "sync",
))]
impl<L: Link> LinkedList<L, L::Target> {
pub(crate) fn last(&self) -> Option<&L::Target> {
let tail = self.tail.as_ref()?;
unsafe { Some(&*tail.as_ptr()) }
}
}
impl<L: Link> Default for LinkedList<L, L::Target> {
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | f478ff4a249b14db2d2cb99900e7894717eaf188 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f478ff4a249b14db2d2cb99900e7894717eaf188/tokio/src/util/linked_list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:9 | impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
where
T: Link,
F: FnMut(&mut T::Target) -> bool,
{
type Item = T::Handle;
fn next(&mut self) -> Option<Self::Item> {
while let Some(curr) = self.curr {
// safety: the pointer references data contained ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:10 | }
}
}
// ===== impl GuardedLinkedList =====
feature! {
#![any(
feature = "process",
feature = "sync",
feature = "rt",
feature = "signal",
)]
/// An intrusive linked list, but instead of keeping pointers to the head
/// and tail nodes, it uses a special guard node l... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:11 | L::pointers(head).as_mut().set_prev(Some(guard));
L::pointers(guard).as_mut().set_next(Some(head));
// The list is not empty, so the tail cannot be `None`.
let tail = self.tail.unwrap();
debug_assert!(L::pointers(tail).as_ref().get_next().... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:12 | let before_last = L::pointers(last).as_ref().get_prev().unwrap();
L::pointers(self.guard).as_mut().set_prev(Some(before_last));
L::pointers(before_last).as_mut().set_next(Some(self.guard));
L::pointers(last).as_mut().set_prev(None);
L::pointers(last).as_... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:13 | let prev = inner as *const Option<NonNull<T>>;
let next = prev.add(1);
ptr::read(next)
}
}
fn set_prev(&mut self, value: Option<NonNull<T>>) {
// SAFETY: prev is the first field in PointersInner, which is #[repr(C)].
unsafe {
let inner = self.inner.ge... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:14 | use std::pin::Pin;
#[derive(Debug)]
#[repr(C)]
struct Entry {
pointers: Pointers<Entry>,
val: i32,
}
unsafe impl<'a> Link for &'a Entry {
type Handle = Pin<&'a Entry>;
type Target = Entry;
fn as_raw(handle: &Pin<&'_ Entry>) -> NonNull<Entry> {
N... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:15 | while let Some(entry) = list.pop_back() {
ret.push(entry.val);
}
ret
}
fn push_all<'a>(
list: &mut LinkedList<&'a Entry, <&'_ Entry as Link>::Target>,
entries: &[Pin<&'a Entry>],
) {
for entry in entries.iter() {
list.push_front(*entry);
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:16 | let a = entry(5);
let b = entry(7);
let c = entry(31);
let mut list = LinkedList::new();
assert!(list.is_empty());
list.push_front(a.as_ref());
assert!(!list.is_empty());
list.push_front(b.as_ref());
list.push_front(c.as_ref());
let items: Vec<i... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:17 | #[test]
fn remove_by_address() {
let a = entry(5);
let b = entry(7);
let c = entry(31);
unsafe {
// Remove first
let mut list = LinkedList::new();
push_all(&mut list, &[c.as_ref(), b.as_ref(), a.as_ref()]);
assert!(list.remove(ptr(&a)... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:18 | assert_ptr_eq!(c, b.pointers.get_next());
assert_ptr_eq!(b, c.pointers.get_prev());
let items = collect_list(&mut list);
assert_eq!([31, 7].to_vec(), items);
}
unsafe {
// Remove middle
let mut list = LinkedList::new();
push_all(... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:19 | unsafe {
// Remove first of two
let mut list = LinkedList::new();
push_all(&mut list, &[b.as_ref(), a.as_ref()]);
assert!(list.remove(ptr(&a)).is_some());
assert_clean!(a);
// a should be no longer there and can't be removed twice
a... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:20 | assert_eq!([5].to_vec(), items);
}
unsafe {
// Remove last item
let mut list = LinkedList::new();
push_all(&mut list, &[a.as_ref()]);
assert!(list.remove(ptr(&a)).is_some());
assert_clean!(a);
assert!(list.head.is_none());
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:21 | list.pop_back();
assert_eq!(1, list.count());
unsafe {
list.remove(ptr(&b));
}
assert_eq!(0, list.count());
}
/// This is a fuzz test. You run it by entering `cargo fuzz run fuzz_linked_list` in CLI in `/tokio/` module.
#[cfg(fuzzing)]
pub fn fuzz_linked_lis... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:22 | ll.push_front(entries[i].as_ref());
}
Op::Pop => {
if reference.is_empty() {
assert!(ll.is_empty());
continue;
}
let v = reference.pop_back();
assert_eq!(v, ll... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/util/linked_list.rs | 841 | 869 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:9 | impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
where
T: Link,
F: FnMut(&mut T::Target) -> bool,
{
type Item = T::Handle;
fn next(&mut self) -> Option<Self::Item> {
while let Some(curr) = self.curr {
// safety: the pointer references data contained ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 1d785fd66fce4a9125c6f0c403dfe1921d011539 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d785fd66fce4a9125c6f0c403dfe1921d011539/tokio/src/util/linked_list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/util/linked_list.rs:10 | pub(crate) struct GuardedLinkedList<L, T> {
/// Pointer to the guard node.
guard: NonNull<T>,
/// Node type marker.
_marker: PhantomData<*const L>,
}
impl<U, L: Link<Handle = NonNull<U>>> LinkedList<L, L::Target> {
/// Turns a linked list into the guarded version by lin... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/linked_list.rs | MIT | 1d785fd66fce4a9125c6f0c403dfe1921d011539 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d785fd66fce4a9125c6f0c403dfe1921d011539/tokio/src/util/linked_list.rs | 361 | 420 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.