Struct DropItem

Source
pub struct DropItem<V> { /* private fields */ }
Expand description

An item that will notify the parent DropTracker once it gets dropped.

DropItem instances are created by DropTracker::track, DropTracker::track_with_value, and related functions. DropItem instances may contain an “underlying value” that affects the item behavior when used with standard traits. The underlying value is either:

  • a clone of key when constructing an item using track(key) (implicit); or
  • value when constructing an item using track_with_value(key, value) (explicit).

To check whether an item is alive or has been dropped, use DropTracker::state or see the documentation for DropTracker for alternatives.

§Coercing and borrowing

DropItem instances may be coerced and borrowed as the the underlying value type. This means that, for example, if you create a DropItem using track(String::from("abc")), you may call all of the String methods on that item.

DropItem also implements the standard traits PartialEq, Eq, PartialOrd, Ord and Hash, Display, Debug if the type of the underlying value implements them.

§Cloning

DropItem does not implement the Clone trait as it would introduce ambiguity with respect to understanding whether the item has been dropped or is still alive when using DropTracker::state.

§Double drop

DropItem instances can be dropped twice or more. Doing so will cause a panic, but will not cause undefined behavior (unless you’re calling drop on an invalid memory location). The panic on double drop is an useful feature to detect logic errors in destructors.

§Safety

Borrowing or performing operations on the underlying value of a DropItem is generally safe when using safe Rust code. However, DropItems are often used in unsafe code and are used to detect potential bugs. In those circumstances, it is possible to trigger undefined behavior. In particular, borrowing or performing operations on a DropItem while another thread is dropping will result in undefined behavior (although it must be noted that this is a bug in the caller code and is not something that should happen in safe Rust code).

Only Drop on a DropItem is guaranteed to be safe in all circumstances.

§Examples

use drop_tracker::DropTracker;

let mut tracker = DropTracker::<u32>::new();

// Create an item using `123u32` as the key. Implicitly, this also sets its value to `123u32`
let item = tracker.track(123);

// Check that the item is alive
tracker.state(&123).alive().expect("item should be alive");

// Dereference the value of the item
assert_eq!(*item, 123);
assert!(!item.is_power_of_two());

// Drop the item and check that it really got dropped
drop(item);
tracker.state(&123).dropped().expect("item should be dropped");

// Create a new item, this time using an explicit `String` value
let abc_item = tracker.track_with_value(111, String::from("abc"));

// Comparison with other items using `String` work using the underlying `String`
// operations
assert_eq!(abc_item, tracker.track_with_value(222, String::from("abc")));
assert_ne!(abc_item, tracker.track_with_value(333, String::from("def")));
assert!(abc_item < tracker.track_with_value(444, String::from("def")));

// Display, debug and hashing also work using the underlying `String` operations
assert_eq!(format!("{}", abc_item), "abc");
assert_eq!(format!("{:?}", abc_item), "DropItem { value: \"abc\", state: Alive }");

use std::collections::hash_map::DefaultHasher;
use std::hash::Hash;
use std::hash::Hasher;
fn hash<T: Hash + ?Sized>(x: &T) -> u64 {
    let mut hasher = DefaultHasher::new();
    x.hash(&mut hasher);
    hasher.finish()
}
assert_eq!(hash(&abc_item), hash(&"abc"));

// Methods on `String` can be called transparently on items
assert_eq!(abc_item.to_ascii_uppercase(), "ABC");

Using hashable items in a set, with an implicit underlying value:

use drop_tracker::DropTracker;
use std::collections::HashSet;

let mut tracker = DropTracker::new();

let mut set = HashSet::from([
    tracker.track(1),
    tracker.track(2),
    tracker.track(3),
]);

set.remove(&3);

tracker.state(&1).alive().expect("first item should be alive");
tracker.state(&2).alive().expect("second item should be alive");
tracker.state(&3).dropped().expect("third item should be dropped");

Using hashable items in a set, with an explicit underlying value:

use drop_tracker::DropTracker;
use std::collections::HashSet;

let mut tracker = DropTracker::new();

let mut set = HashSet::from([
    tracker.track_with_value(1, String::from("first")),
    tracker.track_with_value(2, String::from("second")),
    tracker.track_with_value(3, String::from("third")),
]);

set.remove("third");

tracker.state(&1).alive().expect("first item should be alive");
tracker.state(&2).alive().expect("second item should be alive");
tracker.state(&3).dropped().expect("third item should be dropped");

Trait Implementations§

Source§

impl<V: AsMut<T>, T> AsMut<T> for DropItem<V>

Source§

fn as_mut(&mut self) -> &mut T

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<V: AsRef<T>, T> AsRef<T> for DropItem<V>

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<V: Borrow<[T]>, T> Borrow<[T]> for DropItem<V>

Source§

fn borrow(&self) -> &[T]

Immutably borrows from an owned value. Read more
Source§

impl<V> Borrow<V> for DropItem<V>

Source§

fn borrow(&self) -> &V

Immutably borrows from an owned value. Read more
Source§

impl<V: Borrow<str>> Borrow<str> for DropItem<V>

Source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
Source§

impl<V: BorrowMut<[T]>, T> BorrowMut<[T]> for DropItem<V>

Source§

fn borrow_mut(&mut self) -> &mut [T]

Mutably borrows from an owned value. Read more
Source§

impl<V> BorrowMut<V> for DropItem<V>

Source§

fn borrow_mut(&mut self) -> &mut V

Mutably borrows from an owned value. Read more
Source§

impl<V: BorrowMut<str>> BorrowMut<str> for DropItem<V>

Source§

fn borrow_mut(&mut self) -> &mut str

Mutably borrows from an owned value. Read more
Source§

impl<V: Debug> Debug for DropItem<V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V> Deref for DropItem<V>

Source§

type Target = V

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<V> DerefMut for DropItem<V>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<V: Display> Display for DropItem<V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V> Drop for DropItem<V>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<V: Hash> Hash for DropItem<V>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, V, T> PartialEq<&'a [T]> for DropItem<V>
where V: PartialEq<&'a [T]>,

Source§

fn eq(&self, other: &&'a [T]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, V> PartialEq<&'a str> for DropItem<V>
where V: PartialEq<&'a str>,

Source§

fn eq(&self, other: &&'a str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V, T> PartialEq<[T]> for DropItem<V>
where V: PartialEq<[T]>,

Source§

fn eq(&self, other: &[T]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<()> for DropItem<V>
where V: PartialEq<()>,

Source§

fn eq(&self, other: &()) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V: PartialEq<W>, W> PartialEq<DropItem<W>> for DropItem<V>

Source§

fn eq(&self, other: &DropItem<W>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<bool> for DropItem<V>
where V: PartialEq<bool>,

Source§

fn eq(&self, other: &bool) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<char> for DropItem<V>
where V: PartialEq<char>,

Source§

fn eq(&self, other: &char) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<f32> for DropItem<V>
where V: PartialEq<f32>,

Source§

fn eq(&self, other: &f32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<f64> for DropItem<V>
where V: PartialEq<f64>,

Source§

fn eq(&self, other: &f64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<i128> for DropItem<V>
where V: PartialEq<i128>,

Source§

fn eq(&self, other: &i128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<i16> for DropItem<V>
where V: PartialEq<i16>,

Source§

fn eq(&self, other: &i16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<i32> for DropItem<V>
where V: PartialEq<i32>,

Source§

fn eq(&self, other: &i32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<i64> for DropItem<V>
where V: PartialEq<i64>,

Source§

fn eq(&self, other: &i64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<i8> for DropItem<V>
where V: PartialEq<i8>,

Source§

fn eq(&self, other: &i8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<str> for DropItem<V>
where V: PartialEq<str>,

Source§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<u128> for DropItem<V>
where V: PartialEq<u128>,

Source§

fn eq(&self, other: &u128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<u16> for DropItem<V>
where V: PartialEq<u16>,

Source§

fn eq(&self, other: &u16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<u32> for DropItem<V>
where V: PartialEq<u32>,

Source§

fn eq(&self, other: &u32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<u64> for DropItem<V>
where V: PartialEq<u64>,

Source§

fn eq(&self, other: &u64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V> PartialEq<u8> for DropItem<V>
where V: PartialEq<u8>,

Source§

fn eq(&self, other: &u8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, V, T> PartialOrd<&'a [T]> for DropItem<V>
where V: PartialOrd<&'a [T]>,

Source§

fn partial_cmp(&self, other: &&'a [T]) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, V> PartialOrd<&'a str> for DropItem<V>
where V: PartialOrd<&'a str>,

Source§

fn partial_cmp(&self, other: &&'a str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V, T> PartialOrd<[T]> for DropItem<V>
where V: PartialOrd<[T]>,

Source§

fn partial_cmp(&self, other: &[T]) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<()> for DropItem<V>
where V: PartialOrd<()>,

Source§

fn partial_cmp(&self, other: &()) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V: PartialOrd<W>, W> PartialOrd<DropItem<W>> for DropItem<V>

Source§

fn partial_cmp(&self, other: &DropItem<W>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<bool> for DropItem<V>
where V: PartialOrd<bool>,

Source§

fn partial_cmp(&self, other: &bool) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<char> for DropItem<V>
where V: PartialOrd<char>,

Source§

fn partial_cmp(&self, other: &char) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<f32> for DropItem<V>
where V: PartialOrd<f32>,

Source§

fn partial_cmp(&self, other: &f32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<f64> for DropItem<V>
where V: PartialOrd<f64>,

Source§

fn partial_cmp(&self, other: &f64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<i128> for DropItem<V>
where V: PartialOrd<i128>,

Source§

fn partial_cmp(&self, other: &i128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<i16> for DropItem<V>
where V: PartialOrd<i16>,

Source§

fn partial_cmp(&self, other: &i16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<i32> for DropItem<V>
where V: PartialOrd<i32>,

Source§

fn partial_cmp(&self, other: &i32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<i64> for DropItem<V>
where V: PartialOrd<i64>,

Source§

fn partial_cmp(&self, other: &i64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<i8> for DropItem<V>
where V: PartialOrd<i8>,

Source§

fn partial_cmp(&self, other: &i8) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<str> for DropItem<V>
where V: PartialOrd<str>,

Source§

fn partial_cmp(&self, other: &str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<u128> for DropItem<V>
where V: PartialOrd<u128>,

Source§

fn partial_cmp(&self, other: &u128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<u16> for DropItem<V>
where V: PartialOrd<u16>,

Source§

fn partial_cmp(&self, other: &u16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<u32> for DropItem<V>
where V: PartialOrd<u32>,

Source§

fn partial_cmp(&self, other: &u32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<u64> for DropItem<V>
where V: PartialOrd<u64>,

Source§

fn partial_cmp(&self, other: &u64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V> PartialOrd<u8> for DropItem<V>
where V: PartialOrd<u8>,

Source§

fn partial_cmp(&self, other: &u8) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V: Eq> Eq for DropItem<V>

Auto Trait Implementations§

§

impl<V> Freeze for DropItem<V>
where V: Freeze,

§

impl<V> RefUnwindSafe for DropItem<V>
where V: RefUnwindSafe,

§

impl<V> Send for DropItem<V>
where V: Send,

§

impl<V> Sync for DropItem<V>
where V: Sync,

§

impl<V> Unpin for DropItem<V>
where V: Unpin,

§

impl<V> UnwindSafe for DropItem<V>
where V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.