Struct SplaySet

Source
pub struct SplaySet<T> { /* private fields */ }
Expand description

A set based on splay tree.

A splay tree based set is a self-adjusting data structure. It performs insertion, removal and look-up in O(log n) amortized time.

It is a logic error for a key to be modified in such a way that the key’s ordering relative to any other key, as determined by the Ord trait, changes while it is in the map. This is normally only possible through Cell, RefCell, global state, I/O, or unsafe code.

§Examples

use splay_tree::SplaySet;

let mut set = SplaySet::new();

set.insert("foo");
set.insert("bar");
set.insert("baz");
assert_eq!(set.len(), 3);

assert!(set.contains("bar"));
assert!(set.remove("bar"));
assert!(!set.contains("bar"));

assert_eq!(vec!["baz", "foo"], set.into_iter().collect::<Vec<_>>());

Implementations§

Source§

impl<T> SplaySet<T>
where T: Ord,

Source

pub fn new() -> Self

Makes a new SplaySet

§Examples
use splay_tree::SplaySet;

let set: SplaySet<()> = SplaySet::new();
assert!(set.is_empty());
Source

pub fn clear(&mut self)

Clears the set, removing all values.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
set.clear();
assert!(set.is_empty());
Source

pub fn contains<Q>(&mut self, value: &Q) -> bool
where T: Borrow<Q>, Q: Ord + ?Sized,

Returns true if the set contains a value.

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

Because SplaySet is a self-adjusting amortized data structure, this function requires the mut qualifier for self.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
assert!(set.contains("foo"));
assert!(!set.contains("bar"));
Source

pub fn contains_immut<Q>(&self, value: &Q) -> bool
where T: Borrow<Q>, Q: Ord + ?Sized,

Immutable version of SplaySet::contains().

Note that this method could be less efficient than the mutable version.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
assert!(set.contains_immut("foo"));
assert!(!set.contains_immut("bar"));
Source

pub fn get<Q>(&mut self, value: &Q) -> Option<&T>
where T: Borrow<Q>, Q: Ord + ?Sized,

Returns a reference to the value in the set, if any, that is equal to the given value.

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

Because SplaySet is a self-adjusting amortized data structure, this function requires the mut qualifier for self.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
assert_eq!(set.get("foo"), Some(&"foo"));
assert_eq!(set.get("bar"), None);
Source

pub fn get_immut<Q>(&self, value: &Q) -> Option<&T>
where T: Borrow<Q>, Q: Ord + ?Sized,

Immutable version of SplaySet::get().

Note that this method could be less efficient than the mutable version.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
assert_eq!(set.get_immut("foo"), Some(&"foo"));
assert_eq!(set.get_immut("bar"), None);
Source

pub fn find_lower_bound<Q>(&mut self, value: &Q) -> Option<&T>
where T: Borrow<Q>, Q: Ord + ?Sized,

Finds a minimum element which satisfies “greater than or equal to value” condition in the set.

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.find_lower_bound(&0), Some(&1));
assert_eq!(set.find_lower_bound(&1), Some(&1));
assert_eq!(set.find_lower_bound(&4), None);
Source

pub fn find_lower_bound_immut<Q>(&self, value: &Q) -> Option<&T>
where T: Borrow<Q>, Q: Ord + ?Sized,

Immutable version of SplaySet::find_lower_bound().

Note that this method could be less efficient than the mutable version.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.find_lower_bound_immut(&0), Some(&1));
assert_eq!(set.find_lower_bound_immut(&1), Some(&1));
assert_eq!(set.find_lower_bound_immut(&4), None);
Source

pub fn find_upper_bound<Q>(&mut self, value: &Q) -> Option<&T>
where T: Borrow<Q>, Q: Ord + ?Sized,

Finds a minimum element which satisfies “greater than value” condition in the set.

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.find_upper_bound(&0), Some(&1));
assert_eq!(set.find_upper_bound(&1), Some(&3));
assert_eq!(set.find_upper_bound(&4), None);
Source

pub fn find_upper_bound_immut<Q>(&self, value: &Q) -> Option<&T>
where T: Borrow<Q>, Q: Ord + ?Sized,

Immutable version of SplaySet::find_upper_bound().

Note that this method could be less efficient than the mutable version.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.find_upper_bound_immut(&0), Some(&1));
assert_eq!(set.find_upper_bound_immut(&1), Some(&3));
assert_eq!(set.find_upper_bound_immut(&4), None);
Source

pub fn smallest(&mut self) -> Option<&T>

Gets the minimum value in the map.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.smallest(), Some(&1));
Source

pub fn smallest_immut(&self) -> Option<&T>

Immutable version of SplaySet::smallest().

Note that this method could be less efficient than the mutable version.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.smallest_immut(), Some(&1));
Source

pub fn take_smallest(&mut self) -> Option<T>

Takes the minimum value in the map.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.take_smallest(), Some(1));
assert_eq!(set.take_smallest(), Some(3));
assert_eq!(set.take_smallest(), None);
Source

pub fn largest(&mut self) -> Option<&T>

Gets the maximum value in the map.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.largest(), Some(&3));
Source

pub fn largest_immut(&self) -> Option<&T>

Immutable version of SplaySet::largest().

Note that this method could be less efficient than the mutable version.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.largest_immut(), Some(&3));
Source

pub fn take_largest(&mut self) -> Option<T>

Takes the maximum value in the map.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert(1);
set.insert(3);

assert_eq!(set.take_largest(), Some(3));
assert_eq!(set.take_largest(), Some(1));
assert_eq!(set.take_largest(), None);
Source

pub fn insert(&mut self, value: T) -> bool

Adds a value to the set.

If the set did not have this value present, true is returned.

If the set did have this value present, false is returned, and the entry is not updated.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
assert!(set.insert("foo"));
assert!(!set.insert("foo"));
assert_eq!(set.len(), 1);
Source

pub fn replace(&mut self, value: T) -> Option<T>

Adds a value to the set, replacing the existing value, if any, that is equal to the given one. Returns the replaced value.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
assert_eq!(set.replace("foo"), None);
assert_eq!(set.replace("foo"), Some("foo"));
Source

pub fn remove<Q>(&mut self, value: &Q) -> bool
where T: Borrow<Q>, Q: Ord + ?Sized,

Removes a value from the set. Returns true is the value was present in the set.

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
assert_eq!(set.remove("foo"), true);
assert_eq!(set.remove("foo"), false);
Source

pub fn take<Q>(&mut self, value: &Q) -> Option<T>
where T: Borrow<Q>, Q: Ord + ?Sized,

Removes and returns the value in the set, if any, that is equal to the given one.

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
assert_eq!(set.take("foo"), Some("foo"));
assert_eq!(set.take("foo"), None);
Source

pub fn difference<'a>(&'a self, other: &'a Self) -> Difference<'a, T>

Visits the values representing the difference, in ascending order.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![2, 3, 4].into_iter().collect();

assert_eq!(a.difference(&b).cloned().collect::<Vec<_>>(),
           [1]);
Source

pub fn symmetric_difference<'a>( &'a self, other: &'a Self, ) -> SymmetricDifference<'a, T>

Visits the values representing the symmetric difference, in ascending order.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![2, 3, 4].into_iter().collect();

assert_eq!(a.symmetric_difference(&b).cloned().collect::<Vec<_>>(),
           [1, 4]);
Source

pub fn intersection<'a>(&'a self, other: &'a Self) -> Intersection<'a, T>

Visits the values representing the intersection, in ascending order.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![2, 3, 4].into_iter().collect();

assert_eq!(a.intersection(&b).cloned().collect::<Vec<_>>(),
           [2, 3]);
Source

pub fn union<'a>(&'a self, other: &'a Self) -> Union<'a, T>

Visits the values representing the union, in ascending order.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![2, 3, 4].into_iter().collect();

assert_eq!(a.union(&b).cloned().collect::<Vec<_>>(),
           [1, 2, 3, 4]);
Source

pub fn is_disjoint(&self, other: &Self) -> bool

Returns true if the set has no elements in common with other. This is equivalent to checking for an empty intersection.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![2, 3, 4].into_iter().collect();
let c: SplaySet<_> = vec![4, 5, 6].into_iter().collect();

assert!(!a.is_disjoint(&b));
assert!(!b.is_disjoint(&c));
assert!(a.is_disjoint(&c));
assert!(c.is_disjoint(&a));
Source

pub fn is_subset(&self, other: &Self) -> bool

Returns true if the set is a subset of another.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![2, 3, 4].into_iter().collect();
let c: SplaySet<_> = vec![1, 2, 3, 4].into_iter().collect();

assert!(!a.is_subset(&b));
assert!(!b.is_subset(&a));
assert!(!c.is_subset(&a));
assert!(a.is_subset(&c));
assert!(b.is_subset(&c));
assert!(c.is_subset(&c));
Source

pub fn is_superset(&self, other: &Self) -> bool

Returns true if the set is a superset of another.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![2, 3, 4].into_iter().collect();
let c: SplaySet<_> = vec![1, 2, 3, 4].into_iter().collect();

assert!(!a.is_superset(&b));
assert!(!b.is_superset(&a));
assert!(!a.is_superset(&c));
assert!(c.is_superset(&a));
assert!(c.is_superset(&b));
assert!(c.is_superset(&c));
Source

pub fn as_vec_like_mut(&mut self) -> VecLikeMut<'_, T>

Returns a vector like mutable view of the set.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
set.insert("bar");
{
    let mut vec = set.as_vec_like_mut();
    vec.push("baz");

    assert_eq!(vec.get(0), Some(&"foo"));
    assert_eq!(vec.get(2), Some(&"baz"));

    assert_eq!(vec.find_index(&"bar"), Some(1));

    assert_eq!(vec.iter().cloned().collect::<Vec<_>>(),
               ["foo", "bar", "baz"]);
}
assert_eq!(set.iter().cloned().collect::<Vec<_>>(),
           ["bar", "baz", "foo"]);
Source§

impl<T> SplaySet<T>

Source

pub fn len(&self) -> usize

Returns the number of elements in the set.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
set.insert("bar");
assert_eq!(set.len(), 2);
Source

pub fn is_empty(&self) -> bool

Returns true if the set contains no elements.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
assert!(set.is_empty());

set.insert("foo");
assert!(!set.is_empty());

set.clear();
assert!(set.is_empty());
Source

pub fn iter(&self) -> Iter<'_, T>

Gets an iterator over the SplaySet’s contents, in sorted order.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
set.insert("bar");
set.insert("baz");

assert_eq!(set.iter().collect::<Vec<_>>(), [&"bar", &"baz", &"foo"]);
Source

pub fn as_vec_like(&self) -> VecLike<'_, T>

Returns a vector like view of the set.

§Examples
use splay_tree::SplaySet;

let mut set = SplaySet::new();
set.insert("foo");
set.insert("bar");
{
    let mut vec = set.as_vec_like();
    assert_eq!(vec.get(0), Some(&"foo"));
    assert_eq!(vec.get(1), Some(&"bar"));

    assert_eq!(vec.iter().cloned().collect::<Vec<_>>(),
               ["foo", "bar"]);
}
assert_eq!(set.iter().cloned().collect::<Vec<_>>(),
           ["bar", "foo"]);

Trait Implementations§

Source§

impl<'a, 'b, T> BitAnd<&'b SplaySet<T>> for &'a SplaySet<T>
where T: Ord + Clone,

Source§

fn bitand(self, rhs: &SplaySet<T>) -> SplaySet<T>

Returns the intersection of self and rhs as a new SplaySet<T>.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![3, 4, 5].into_iter().collect();

assert_eq!((&a & &b).into_iter().collect::<Vec<_>>(),
           [3]);
Source§

type Output = SplaySet<T>

The resulting type after applying the & operator.
Source§

impl<'a, 'b, T> BitOr<&'b SplaySet<T>> for &'a SplaySet<T>
where T: Ord + Clone,

Source§

fn bitor(self, rhs: &SplaySet<T>) -> SplaySet<T>

Returns the union of self and rhs as a new SplaySet<T>.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![3, 4, 5].into_iter().collect();

assert_eq!((&a | &b).into_iter().collect::<Vec<_>>(),
           [1, 2, 3, 4, 5]);
Source§

type Output = SplaySet<T>

The resulting type after applying the | operator.
Source§

impl<'a, 'b, T> BitXor<&'b SplaySet<T>> for &'a SplaySet<T>
where T: Ord + Clone,

Source§

fn bitxor(self, rhs: &SplaySet<T>) -> SplaySet<T>

Returns the symmetric difference of self and rhs as a new SplaySet<T>.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![3, 4, 5].into_iter().collect();

assert_eq!((&a ^ &b).into_iter().collect::<Vec<_>>(),
           [1, 2, 4, 5]);
Source§

type Output = SplaySet<T>

The resulting type after applying the ^ operator.
Source§

impl<T: Clone> Clone for SplaySet<T>

Source§

fn clone(&self) -> SplaySet<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for SplaySet<T>

Source§

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

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

impl<T> Default for SplaySet<T>
where T: Ord,

Source§

fn default() -> Self

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

impl<'a, T> Extend<&'a T> for SplaySet<T>
where T: Copy + 'a + Ord,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = &'a T>,

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

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T> Extend<T> for SplaySet<T>
where T: Ord,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = T>,

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

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T> FromIterator<T> for SplaySet<T>
where T: Ord,

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
Source§

impl<T: Hash> Hash for SplaySet<T>

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, T> IntoIterator for &'a SplaySet<T>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> IntoIterator for SplaySet<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Ord> Ord for SplaySet<T>

Source§

fn cmp(&self, other: &SplaySet<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq> PartialEq for SplaySet<T>

Source§

fn eq(&self, other: &SplaySet<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<T: PartialOrd> PartialOrd for SplaySet<T>

Source§

fn partial_cmp(&self, other: &SplaySet<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, 'b, T> Sub<&'b SplaySet<T>> for &'a SplaySet<T>
where T: Ord + Clone,

Source§

fn sub(self, rhs: &SplaySet<T>) -> SplaySet<T>

Returns the difference of self and rhs as a new SplaySet<T>.

§Examples
use splay_tree::SplaySet;

let a: SplaySet<_> = vec![1, 2, 3].into_iter().collect();
let b: SplaySet<_> = vec![3, 4, 5].into_iter().collect();

assert_eq!((&a - &b).into_iter().collect::<Vec<_>>(),
           [1, 2]);
Source§

type Output = SplaySet<T>

The resulting type after applying the - operator.
Source§

impl<T: Eq> Eq for SplaySet<T>

Source§

impl<T> StructuralPartialEq for SplaySet<T>

Auto Trait Implementations§

§

impl<T> Freeze for SplaySet<T>

§

impl<T> RefUnwindSafe for SplaySet<T>
where T: RefUnwindSafe,

§

impl<T> Send for SplaySet<T>
where T: Send,

§

impl<T> Sync for SplaySet<T>
where T: Sync,

§

impl<T> Unpin for SplaySet<T>
where T: Unpin,

§

impl<T> UnwindSafe for SplaySet<T>
where T: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.