#[repr(transparent)]
pub struct TiVec<K, V> { pub raw: Vec<V>, /* private fields */ }
Expand description

A contiguous growable array type that only accepts keys of the type K.

TiVec<K, V> is a wrapper around Rust container type std::vec::Vec. The struct mirrors the stable API of Rust std::vec::Vec and forwards to it as much as possible.

TiVec<K, V> uses K instead of usize for element indices and require the index to implement From<usize> and Into<usize> traits. Their implementation can be easily done with derive_more crate and #[derive(From, Into)].

TiVec<K, V> can be converted to std::vec::Vec<V> and back using From and Into.

There are also zero-cost conversions available between references:

Added methods:

  • from_ref - Converts a &std::vec::Vec<V> into a &TiVec<K, V>.
  • from_mut - Converts a &mut std::vec::Vec<V> into a &mut TiVec<K, V>.
  • push_and_get_key - Appends an element to the back of a collection and returns its index of type K.
  • pop_key_value - Removes the last element from a vector and returns it with its index of type K, or None if the vector is empty.
  • drain_enumerated - Creates a draining iterator that removes the specified range in the vector and yields the current count and the removed items. It acts like self.drain(range).enumerate(), but instead of usize it returns index of type K.
  • into_iter_enumerated - Converts the vector into iterator over all key-value pairs with K used for iteration indices. It acts like self.into_iter().enumerate(), but use K instead of usize for iteration indices.

Example

use typed_index_collections::TiVec;
use derive_more::{From, Into};

#[derive(From, Into)]
struct FooId(usize);

let mut foos: TiVec<FooId, usize> = std::vec![10, 11, 13].into();
foos.insert(FooId(2), 12);
assert_eq!(foos[FooId(2)], 12);

Fields

raw: Vec<V>

Raw slice property

Implementations

Constructs a new, empty TiVec<K, V>.

See Vec::new for more details.

Constructs a new, empty TiVec<K, V> with the specified capacity.

See Vec::with_capacity for more details.

Creates a TiVec<K, V> directly from the raw components of another vector.

See Vec::from_raw_parts for more details.

Converts a &std::vec::Vec<V> into a &TiVec<K, V>.

Vector reference is intentionally used in the argument instead of slice reference for conversion with no-op.

Example
pub struct Id(usize);
let vec: &TiVec<Id, usize> = TiVec::from_ref(&vec![1, 2, 4]);

Converts a [&mut std::vec::Vec<V>] into a &mut TiVec<K, V>.

Example
pub struct Id(usize);
let vec: &mut TiVec<Id, usize> = TiVec::from_mut(&mut vec![1, 2, 4]);

Returns the number of elements the vector can hold without reallocating.

See Vec::capacity for more details.

Reserves capacity for at least additional more elements to be inserted in the given TiVec<K, V>. The collection may reserve more space to avoid frequent reallocations. After calling reserve, capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.

See Vec::reserve for more details.

Reserves the minimum capacity for exactly additional more elements to be inserted in the given TiVec<K, V>. After calling reserve_exact, capacity will be greater than or equal to self.len() + additional. Does nothing if the capacity is already sufficient.

See Vec::reserve_exact for more details.

Shrinks the capacity of the vector as much as possible.

See Vec::shrink_to_fit for more details.

Converts the vector into Box<TiSlice<K, V>>.

See Vec::into_boxed_slice for more details.

Shortens the vector, keeping the first len elements and dropping the rest.

See Vec::truncate for more details.

Extracts a slice containing the entire vector.

See Vec::as_slice for more details.

Extracts a mutable slice of the entire vector.

See Vec::as_mut_slice for more details.

Returns a raw pointer to the vector’s buffer.

See Vec::as_ptr for more details.

Returns an unsafe mutable pointer to the vector’s buffer.

See Vec::as_mut_ptr for more details.

Forces the length of the vector to new_len.

See Vec::set_len for more details.

Removes an element from the vector and returns it.

The removed element is replaced by the last element of the vector.

See Vec::swap_remove for more details.

Inserts an element at position index within the vector, shifting all elements after it to the right.

See Vec::insert for more details.

Removes and returns the element at position index within the vector, shifting all elements after it to the left.

See Vec::remove for more details.

Retains only the elements specified by the predicate.

See Vec::retain for more details.

Removes all but the first of consecutive elements in the vector that resolve to the same key.

See Vec::dedup_by_key for more details.

Removes all but the first of consecutive elements in the vector satisfying a given equality relation.

See Vec::dedup_by for more details.

Appends an element to the back of a collection.

See Vec::push for more details.

Appends an element to the back of a collection and returns its index of type K.

It acts like { vec.push(...); vec.last_key().unwrap() }, but is optimized better.

See Vec::push for more details.

Example
#[derive(Eq, Debug, From, Into, PartialEq)]
pub struct Id(usize);
let mut vec: TiVec<Id, usize> = vec![1, 2, 4].into();
assert_eq!(vec.push_and_get_key(8), Id(3));
assert_eq!(vec.push_and_get_key(16), Id(4));
assert_eq!(vec.push_and_get_key(32), Id(5));

Removes the last element from a vector and returns it, or None if it is empty.

See Vec::pop for more details.

Removes the last element from a vector and returns it with its index of type K, or None if the vector is empty.

See Vec::pop for more details.

Example
#[derive(Eq, Debug, From, Into, PartialEq)]
pub struct Id(usize);
let mut vec: TiVec<Id, usize> = vec![1, 2, 4].into();
assert_eq!(vec.pop_key_value(), Some((Id(2), 4)));
assert_eq!(vec.pop_key_value(), Some((Id(1), 2)));
assert_eq!(vec.pop_key_value(), Some((Id(0), 1)));
assert_eq!(vec.pop_key_value(), None);

Moves all the elements of other into Self, leaving other empty.

See Vec::append for more details.

Creates a draining iterator that removes the specified range in the vector and yields the removed items.

See Vec::drain for more details.

Creates a draining iterator that removes the specified range in the vector and yields the current count and the removed items.

It acts like self.drain(range).enumerate(), but instead of usize it returns index of type K.

Note that the indices started from K::from_usize(0), regardless of the range starting point.

See Vec::drain for more details.

Example
#[derive(Eq, Debug, From, Into, PartialEq)]
pub struct Id(usize);
let mut vec: TiVec<Id, usize> = vec![1, 2, 4].into();
{
    let mut iterator = vec.drain_enumerated(Id(1)..);
    assert_eq!(iterator.next(), Some((Id(0), 2)));
    assert_eq!(iterator.next(), Some((Id(1), 4)));
    assert_eq!(iterator.next(), None);
}
assert_eq!(vec.as_slice(), TiSlice::from_ref(&[1]));

Clears the vector, removing all values.

See Vec::clear for more details.

Returns the number of elements in the vector, also referred to as its ‘length’.

See Vec::len for more details.

Returns true if the vector contains no elements.

See Vec::is_empty for more details.

Splits the collection into two at the given index.

See Vec::split_off for more details.

Resizes the TiVec in-place so that len is equal to new_len.

See Vec::resize_with for more details.

Resizes the TiVec in-place so that len is equal to new_len.

See Vec::resize for more details.

Clones and appends all elements in a slice to the TiVec.

See Vec::extend_from_slice for more details.

Removes consecutive repeated elements in the vector according to the PartialEq trait implementation.

See Vec::dedup for more details.

Creates a splicing iterator that replaces the specified range in the vector with the given replace_with iterator and yields the removed items. replace_with does not need to be the same length as range.

See Vec::splice for more details.

Converts the vector into iterator over all key-value pairs with K used for iteration indices.

It acts like self.into_iter().enumerate(), but use K instead of usize for iteration indices.

Example
#[derive(Eq, Debug, From, Into, PartialEq)]
pub struct Id(usize);
let vec: TiVec<Id, usize> = vec![1, 2, 4].into();
let mut iterator = vec.into_iter_enumerated();
assert_eq!(iterator.next(), Some((Id(0), 1)));
assert_eq!(iterator.next(), Some((Id(1), 2)));
assert_eq!(iterator.next(), Some((Id(2), 4)));
assert_eq!(iterator.next(), None);

Methods from Deref<Target = TiSlice<K, V>>

Returns the number of elements in the slice.

See slice::len for more details.

Returns the index of the next slice element to be appended and at the same time number of elements in the slice of type K.

Example
#[derive(Eq, Debug, From, Into, PartialEq)]
pub struct Id(usize);
let slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[1, 2, 4]);
assert_eq!(slice.next_key(), Id(3));

Returns true if the slice has a length of 0.

See slice::is_empty for more details.

Returns an iterator over all keys.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[1, 2, 4]);
let mut iterator = slice.keys();
assert_eq!(iterator.next(), Some(Id(0)));
assert_eq!(iterator.next(), Some(Id(1)));
assert_eq!(iterator.next(), Some(Id(2)));
assert_eq!(iterator.next(), None);

Returns the first element of the slice, or None if it is empty.

See slice::first for more details.

Returns a mutable reference to the first element of the slice, or None if it is empty.

See slice::first_mut for more details.

Returns the first slice element index of type K, or None if the slice is empty.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let empty_slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[]);
let slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[1, 2, 4]);
assert_eq!(empty_slice.first_key(), None);
assert_eq!(slice.first_key(), Some(Id(0)));

Returns the first slice element index of type K and the element itself, or None if the slice is empty.

See slice::first for more details.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let empty_slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[]);
let slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[1, 2, 4]);
assert_eq!(empty_slice.first_key_value(), None);
assert_eq!(slice.first_key_value(), Some((Id(0), &1)));

Returns the first slice element index of type K and a mutable reference to the element itself, or None if the slice is empty.

See slice::first_mut for more details.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let empty_slice: &mut TiSlice<Id, usize> = TiSlice::from_mut(&mut []);
let mut array = [1, 2, 4];
let slice: &mut TiSlice<Id, usize> = TiSlice::from_mut(&mut array);
assert_eq!(empty_slice.first_key_value_mut(), None);
assert_eq!(slice.first_key_value_mut(), Some((Id(0), &mut 1)));
*slice.first_key_value_mut().unwrap().1 = 123;
assert_eq!(slice.raw, [123, 2, 4]);

Returns the first and all the rest of the elements of the slice, or None if it is empty.

See slice::split_first for more details.

Returns the first and all the rest of the elements of the slice, or None if it is empty.

See slice::split_first_mut for more details.

Returns the last and all the rest of the elements of the slice, or None if it is empty.

See slice::split_last for more details.

Returns the last and all the rest of the elements of the slice, or None if it is empty.

See slice::split_last_mut for more details.

Returns the last element of the slice of type K, or None if it is empty.

See slice::last for more details.

Returns a mutable reference to the last item in the slice.

See slice::last_mut for more details.

Returns the last slice element index of type K, or None if the slice is empty.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let empty_slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[]);
let slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[1, 2, 4]);
assert_eq!(empty_slice.last_key(), None);
assert_eq!(slice.last_key(), Some(Id(2)));

Returns the last slice element index of type K and the element itself, or None if the slice is empty.

See slice::last for more details.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let empty_slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[]);
let slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[1, 2, 4]);
assert_eq!(empty_slice.last_key_value(), None);
assert_eq!(slice.last_key_value(), Some((Id(2), &4)));

Returns the last slice element index of type K and a mutable reference to the element itself, or None if the slice is empty.

See slice::last_mut for more details.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let empty_slice: &mut TiSlice<Id, usize> = TiSlice::from_mut(&mut []);
let mut array = [1, 2, 4];
let slice: &mut TiSlice<Id, usize> = TiSlice::from_mut(&mut array);
assert_eq!(empty_slice.last_key_value_mut(), None);
assert_eq!(slice.last_key_value_mut(), Some((Id(2), &mut 4)));
*slice.last_key_value_mut().unwrap().1 = 123;
assert_eq!(slice.raw, [1, 2, 123]);

Returns a reference to an element or subslice depending on the type of index or None if the index is out of bounds.

See slice::get for more details.

Returns a mutable reference to an element or subslice depending on the type of index or None if the index is out of bounds.

See slice::get_mut for more details.

Returns a reference to an element or subslice depending on the type of index, without doing bounds checking.

This is generally not recommended, use with caution! Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used. For a safe alternative see get.

See slice::get_unchecked for more details.

Returns a mutable reference to an element or subslice depending on the type of index, without doing bounds checking.

This is generally not recommended, use with caution! Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used. For a safe alternative see get_mut.

See slice::get_unchecked_mut for more details.

Returns a raw pointer to the slice’s buffer.

See slice::as_ptr for more details.

Returns an unsafe mutable reference to the slice’s buffer.

See slice::as_mut_ptr for more details.

Swaps two elements in the slice.

See slice::swap for more details.

Reverses the order of elements in the slice, in place.

See slice::reverse for more details.

Returns an iterator over the slice.

See slice::iter for more details.

Returns an iterator over all key-value pairs.

It acts like self.iter().enumerate(), but use K instead of usize for iteration indices.

See slice::iter for more details.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[1, 2, 4]);
let mut iterator = slice.iter_enumerated();
assert_eq!(iterator.next(), Some((Id(0), &1)));
assert_eq!(iterator.next(), Some((Id(1), &2)));
assert_eq!(iterator.next(), Some((Id(2), &4)));
assert_eq!(iterator.next(), None);

Returns an iterator that allows modifying each value.

See slice::iter_mut for more details.

Returns an iterator over all key-value pairs, with mutable references to the values.

It acts like self.iter_mut().enumerate(), but use K instead of usize for iteration indices.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let mut array = [1, 2, 4];
let slice: &mut TiSlice<Id, usize> = TiSlice::from_mut(&mut array);
for (key, value) in slice.iter_mut_enumerated() {
    *value += key.0;
}
assert_eq!(array, [1, 3, 6]);

Searches for an element in an iterator, returning its index of type K.

It acts like self.iter().position(...), but instead of usize it returns index of type K.

See slice::iter and Iterator::position for more details.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[1, 2, 4, 2, 1]);
assert_eq!(slice.position(|&value| value == 1), Some(Id(0)));
assert_eq!(slice.position(|&value| value == 2), Some(Id(1)));
assert_eq!(slice.position(|&value| value == 3), None);
assert_eq!(slice.position(|&value| value == 4), Some(Id(2)));

Searches for an element in an iterator from the right, returning its index of type K.

It acts like self.iter().rposition(...), but instead of usize it returns index of type K.

See slice::iter and Iterator::position for more details.

Example
#[derive(Debug, Eq, From, Into, PartialEq)]
pub struct Id(usize);
let slice: &TiSlice<Id, usize> = TiSlice::from_ref(&[1, 2, 4, 2, 1]);
assert_eq!(slice.rposition(|&value| value == 1), Some(Id(4)));
assert_eq!(slice.rposition(|&value| value == 2), Some(Id(3)));
assert_eq!(slice.rposition(|&value| value == 3), None);
assert_eq!(slice.rposition(|&value| value == 4), Some(Id(2)));

Returns an iterator over all contiguous windows of length size. The windows overlap. If the slice is shorter than size, the iterator returns no values.

See slice::windows for more details.

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

See slice::chunks for more details.

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

See slice::chunks_mut for more details.

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

See slice::chunks_exact for more details.

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

See slice::chunks_exact_mut for more details.

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

See slice::rchunks for more details.

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

See slice::rchunks_mut for more details.

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

See slice::rchunks_exact for more details.

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

See slice::rchunks_exact_mut for more details.

Divides one slice into two at an index.

See slice::split_at for more details.

Divides one mutable slice into two at an index.

See slice::split_at_mut for more details.

Returns an iterator over subslices separated by elements that match pred. The matched element is not contained in the subslices.

See slice::split for more details.

Returns an iterator over mutable subslices separated by elements that match pred. The matched element is not contained in the subslices.

See slice::split_mut for more details.

Returns an iterator over subslices separated by elements that match pred, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.

See slice::rsplit for more details.

Returns an iterator over mutable subslices separated by elements that match pred, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.

See slice::rsplit_mut for more details.

Returns an iterator over subslices separated by elements that match pred, limited to returning at most n items. The matched element is not contained in the subslices.

See slice::splitn for more details.

Returns an iterator over subslices separated by elements that match pred, limited to returning at most n items. The matched element is not contained in the subslices.

See slice::splitn_mut for more details.

Returns an iterator over subslices separated by elements that match pred limited to returning at most n items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.

See slice::rsplitn for more details.

Returns an iterator over subslices separated by elements that match pred limited to returning at most n items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.

See slice::rsplitn_mut for more details.

Returns true if the slice contains an element with the given value.

See slice::contains for more details.

Returns true if needle is a prefix of the slice.

See slice::starts_with for more details.

Returns true if needle is a suffix of the slice.

See slice::ends_with for more details.

Binary searches this sorted slice for a given element.

See slice::binary_search for more details.

Binary searches this sorted slice with a comparator function.

See slice::binary_search_by for more details.

Binary searches this sorted slice with a key extraction function.

See slice::binary_search_by_key for more details.

Sorts the slice, but may not preserve the order of equal elements.

See slice::sort_unstable for more details.

Sorts the slice with a comparator function, but may not preserve the order of equal elements.

See slice::sort_unstable_by for more details.

Sorts the slice with a key extraction function, but may not preserve the order of equal elements.

See slice::sort_unstable_by_key for more details.

Rotates the slice in-place such that the first mid elements of the slice move to the end while the last self.next_key() - mid elements move to the front. After calling rotate_left, the element previously at index mid will become the first element in the slice.

See slice::rotate_left for more details.

Rotates the slice in-place such that the first self.next_key() - k elements of the slice move to the end while the last k elements move to the front. After calling rotate_right, the element previously at index self.next_key() - k will become the first element in the slice.

See slice::rotate_right for more details.

Copies the elements from src into self.

See slice::clone_from_slice for more details.

Copies all elements from src into self, using a memcpy.

See slice::copy_from_slice for more details.

Copies elements from one part of the slice to another part of itself, using a memmove.

See slice::copy_within for more details.

Swaps all elements in self with those in other.

See slice::swap_with_slice for more details.

Transmute the slice to a slice of another type, ensuring alignment of the types is maintained.

See slice::align_to for more details.

Transmute the slice to a slice of another type, ensuring alignment of the types is maintained.

See slice::align_to_mut for more details.

Checks if all bytes in this slice are within the ASCII range.

See slice::is_ascii for more details.

Checks that two slices are an ASCII case-insensitive match.

See slice::eq_ignore_ascii_case for more details.

Converts this slice to its ASCII upper case equivalent in-place.

See slice::make_ascii_uppercase for more details.

Converts this slice to its ASCII lower case equivalent in-place.

See slice::make_ascii_lowercase for more details.

Sorts the slice.

See slice::sort for more details.

Sorts the slice with a comparator function.

See slice::sort_by for more details.

Sorts the slice with a key extraction function.

See slice::sort_by_key for more details.

Sorts the slice with a key extraction function.

See slice::sort_by_cached_key for more details.

Copies self into a new TiVec.

See slice::to_vec for more details.

Creates a vector by repeating a slice n times.

See slice::repeat for more details.

Flattens a slice of T into a single value Self::Output.

See slice::concat for more details.

Flattens a slice of T into a single value Self::Output, placing a given separator between each.

See slice::join for more details.

Returns a vector containing a copy of this slice where each byte is mapped to its ASCII upper case equivalent.

See slice::to_ascii_uppercase for more details.

Returns a vector containing a copy of this slice where each byte is mapped to its ASCII lower case equivalent.

See slice::to_ascii_lowercase for more details.

Trait Implementations

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

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

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

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

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

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

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

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

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

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

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Deserialize this value from the given Serde deserializer. Read more

Extends a collection with the contents of an iterator. Read more

🔬This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Extends a collection with the contents of an iterator. Read more

🔬This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Creates a value from an iterator. Read more

Feeds this value into the given Hasher. Read more

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.