Struct Condition

Source
pub struct Condition { /* private fields */ }
Expand description

Representation of an Aspen condition clause in a statement.

This is (logically and physically) a two-level map. The first level (this structure) maps ConditionOp operators to a ConditionMap. The second level, the ConditionMap itself, maps condition variable names to a list of allowed values.

Implementations§

Source§

impl Condition

Source

pub fn new() -> Self

Create a new condition clause with no values.

Source

pub fn append(&mut self, other: &mut Self)

Moves all elements from other into self, leaving other empty.

§Examples

let mut a = Condition::new();
a.insert(condop::StringEquals, ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]));

let mut b = Condition::new();
b.insert(condop::StringLike, ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]));

a.append(&mut b);

assert_eq!(a.len(), 2);
assert_eq!(b.len(), 0);
Source

pub fn clear(&mut self)

Clears the condition clause, removing all elements.

§Examples

Basic usage:


let mut a = Condition::new();
a.insert(condop::StringEquals, ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]));
a.clear();
assert!(a.is_empty());
Source

pub fn contains_key<Q>(&self, key: &Q) -> bool
where ConditionOp: Borrow<Q>, Q: Ord + ?Sized,

Returns true if the condition clause contains a value for the specified ConditionOp operator.

§Examples

Basic usage:


let mut condition = Condition::new();
condition.insert(condop::StringEquals, ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]));
assert_eq!(condition.contains_key(&condop::StringEquals), true);
assert_eq!(condition.contains_key(&condop::NumericEquals), false);
Source

pub fn entry( &mut self, key: ConditionOp, ) -> Entry<'_, ConditionOp, ConditionMap>

Gets the given ConditionOp operator’s corresponding entry in the map for in-place manipulation.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
condition.insert(condop::StringEquals, cmap);
condition.entry(condop::StringEquals).and_modify(|e| {
    e.insert("b".to_string(), StringLikeList::<String>::from("B".to_string()));
});

assert_eq!(condition.get(&condop::StringEquals).unwrap().len(), 2);
Source

pub fn get<Q>(&self, key: &Q) -> Option<&ConditionMap>
where ConditionOp: Borrow<Q>, Q: Ord + ?Sized,

Returns a reference to the ConditionMap corresponding to the ConditionOp operator.

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

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
condition.insert(condop::StringEquals, cmap.clone());
assert_eq!(condition.get(&condop::StringEquals), Some(&cmap));
assert_eq!(condition.get(&condop::StringLike), None);
Source

pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&ConditionOp, &ConditionMap)>
where ConditionOp: Borrow<Q>, Q: Ord + ?Sized,

Returns the (ConditionOp, ConditionMap) key-value pair corresponding to the supplied ConditionOp operator.

§Examples

let mut condition = Condition::new();
let cmap = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
condition.insert(condop::StringEquals, cmap.clone());
assert_eq!(condition.get_key_value(&condop::StringEquals), Some((&condop::StringEquals, &cmap)));
assert_eq!(condition.get_key_value(&condop::StringLike), None);
Source

pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut ConditionMap>
where ConditionOp: Borrow<Q>, Q: Ord + ?Sized,

Returns a mutable reference to the ConditionMap corresponding to the ConditionOp operator.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
condition.insert(condop::StringEquals, cmap1);
if let Some(x) = condition.get_mut(&condop::StringEquals) {
    *x = cmap2.clone();
}
assert_eq!(condition[&condop::StringEquals], cmap2);
Source

pub fn insert( &mut self, key: ConditionOp, value: ConditionMap, ) -> Option<ConditionMap>

Inserts a key-value pair into the Condition clause.

If the clause did not have this operator present, None is returned.

If the clause did have this operator present, the value is updated, and the old value is returned.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);

assert_eq!(condition.insert(condop::StringEquals, cmap1.clone()), None);
assert_eq!(condition.insert(condop::StringEquals, cmap2.clone()), Some(cmap1));
Source

pub fn into_keys(self) -> IntoKeys<ConditionOp, ConditionMap>

Creates a consuming iterator visiting all the ConditionOp operators, in sorted order. The map cannot be used after calling this.

§Examples

let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
condition.insert(condop::StringEquals, cmap1);
condition.insert(condop::StringEqualsIgnoreCase, cmap2);

let keys: Vec<ConditionOp> = condition.into_keys().collect();
assert_eq!(keys, [condop::StringEquals, condop::StringEqualsIgnoreCase]);
Source

pub fn into_values(self) -> IntoValues<ConditionOp, ConditionMap>

Creates a consuming iterator visiting all the values, in order by the ConditionOp operator. The map cannot be used after calling this.

§Examples

let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
condition.insert(condop::StringEquals, cmap1.clone());
condition.insert(condop::StringEqualsIgnoreCase, cmap2.clone());

let values: Vec<ConditionMap> = condition.into_values().collect();
assert_eq!(values, [cmap1, cmap2]);
Source

pub fn is_empty(&self) -> bool

Returns true if the condition clause contains no elements.

§Examples

Basic usage:


let mut condition = Condition::new();
assert!(condition.is_empty());
let cmap = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
condition.insert(condop::StringEquals, cmap);
assert!(!condition.is_empty());
Source

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

Gets an iterator over the (&ConditionOp, &ConditionMap) entries of the condition clause, sorted by ConditionOp operator.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
let cmap3 = ConditionMap::from_iter(vec![("c".to_string(), StringLikeList::<String>::from("C".to_string()))]);

condition.insert(condop::Bool, cmap2.clone());
condition.insert(condop::ArnLike, cmap1.clone());
condition.insert(condop::StringEquals, cmap3.clone());

let values: Vec<(&ConditionOp, &ConditionMap)> = condition.iter().collect();
assert_eq!(values, vec![(&condop::ArnLike, &cmap1), (&condop::Bool, &cmap2), (&condop::StringEquals, &cmap3)]);
Source

pub fn iter_mut(&mut self) -> IterMut<'_, ConditionOp, ConditionMap>

Gets an mutable iterator over the (&ConditionOp, &mut ConditionMap) entries of the condition clause, sorted by ConditionOp operator.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
let cmap3 = ConditionMap::from_iter(vec![("c".to_string(), StringLikeList::<String>::from("C".to_string()))]);

condition.insert(condop::Bool, cmap2.clone());
condition.insert(condop::ArnLike, cmap1.clone());
condition.insert(condop::StringEquals, cmap3.clone());

let values: Vec<(&ConditionOp, &ConditionMap)> = condition.iter().collect();
// Add a new variable to the Bool operator.
for (key, value) in condition.iter_mut() {
    if key == &condop::Bool {
       value.insert("d".to_string(), StringLikeList::<String>::from("D".to_string()));
    }
}
Source

pub fn keys(&self) -> Keys<'_, ConditionOp, ConditionMap>

Gets an iterator over the ConditionOp operator keys of the map, in sorted order.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
let cmap3 = ConditionMap::from_iter(vec![("c".to_string(), StringLikeList::<String>::from("C".to_string()))]);

condition.insert(condop::Bool, cmap2.clone());
condition.insert(condop::ArnLike, cmap1.clone());
condition.insert(condop::StringEquals, cmap3.clone());

let keys: Vec<ConditionOp> = condition.keys().cloned().collect();
assert_eq!(keys, [condop::ArnLike, condop::Bool, condop::StringEquals]);
Source

pub fn len(&self) -> usize

Returns the number of elements in the condition clause.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
assert_eq!(condition.len(), 0);
condition.insert(condop::StringEquals, cmap);
assert_eq!(condition.len(), 1);
Source

pub fn range<T, R>(&self, range: R) -> Range<'_, ConditionOp, ConditionMap>
where ConditionOp: Borrow<T>, T: Ord + ?Sized, R: RangeBounds<T>,

Constructs a double-ended iterator over a sub-range of elements in the condition clause. The simplest way is to use the range syntax min..max, thus range(min..max) will yield elements from min (inclusive) to max (exclusive). The range may also be entered as (Bound<T>, Bound<T>), so for example range((Excluded(condop::ArnLike), Included(condop::StringEquals))) will yield a left-exclusive, right-inclusive range.

§Panics

Panics if range start > end. Panics if range start == end and both bounds are Excluded.

§Examples

Basic usage:

use std::ops::Bound::Included;

let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
let cmap3 = ConditionMap::from_iter(vec![("c".to_string(), StringLikeList::<String>::from("C".to_string()))]);

condition.insert(condop::ArnLike, cmap1.clone());
condition.insert(condop::Bool, cmap2.clone());
condition.insert(condop::StringEquals, cmap3.clone());

let result: Vec<(&ConditionOp, &ConditionMap)> = condition.range((Included(condop::Bool), Included(condop::NumericEquals))).collect();
assert_eq!(result, vec![(&condop::Bool, &cmap2)]);
Source

pub fn range_mut<T, R>( &mut self, range: R, ) -> RangeMut<'_, ConditionOp, ConditionMap>
where ConditionOp: Borrow<T>, T: Ord + ?Sized, R: RangeBounds<T>,

Constructs a mutable double-ended iterator over a sub-range of elements in the condition clause. The simplest way is to use the range syntax min..max, thus range(min..max) will yield elements from min (inclusive) to max (exclusive). The range may also be entered as (Bound<T>, Bound<T>), so for example range((Excluded(condop::ArnLike), Included(condop::StringEquals))) will yield a left-exclusive, right-inclusive range.

§Panics

Panics if range start > end. Panics if range start == end and both bounds are Excluded.

§Examples

Basic usage:

use std::ops::Bound::Included;

let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
let cmap3 = ConditionMap::from_iter(vec![("c".to_string(), StringLikeList::<String>::from("C".to_string()))]);

condition.insert(condop::ArnLike, cmap1);
condition.insert(condop::Bool, cmap2);
condition.insert(condop::StringEquals, cmap3);

for (_, cmap) in condition.range_mut((Included(condop::Bool), Included(condop::NumericEquals))) {
    cmap.insert("d".to_string(), StringLikeList::<String>::from("D".to_string()));
}

assert_eq!(condition.get(&condop::Bool).unwrap().len(), 2);
Source

pub fn remove<Q>(&mut self, key: &Q) -> Option<ConditionMap>
where ConditionOp: Borrow<Q>, Q: Ord + ?Sized,

Removes a ConditionOp operator from the condition clause, returning the ConditionMap corresponding to the operator if the operator was previously in the clause.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);

condition.insert(condop::Bool, cmap.clone());

assert_eq!(condition.remove(&condop::Bool), Some(cmap));
assert_eq!(condition.remove(&condop::Bool), None);
Source

pub fn remove_entry<Q>( &mut self, key: &Q, ) -> Option<(ConditionOp, ConditionMap)>
where ConditionOp: Borrow<Q>, Q: Ord + ?Sized,

Removes a ConditionOp operator from the condition clause, returning the stored operator and ConditionMap if the operator was previously in the clause.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);

condition.insert(condop::Bool, cmap.clone());

assert_eq!(condition.remove_entry(&condop::Bool), Some((condop::Bool, cmap)));
assert_eq!(condition.remove(&condop::Bool), None);
Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&ConditionOp, &mut ConditionMap) -> bool,

Retains only the elements specified by the predicate.

In other words, remove all pairs (cond_op, cond_map) for which f(&cond_op, &mut cond_map) returns false. The elements are visited in ascending ConditionOp order.

§Examples

let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
let cmap3 = ConditionMap::from_iter(vec![("c".to_string(), StringLikeList::<String>::from("C".to_string()))]);

condition.insert(condop::ArnLike, cmap1);
condition.insert(condop::Bool, cmap2.clone());
condition.insert(condop::StringEquals, cmap3);

// Keep only the Bool key.
condition.retain(|&k, _| k == condop::Bool);
assert!(condition.into_iter().eq(vec![(condop::Bool, cmap2)]));
Source

pub fn split_off<Q>(&mut self, key: &Q) -> Condition
where ConditionOp: Borrow<Q>, Q: Ord + ?Sized,

Splits the collection into two at the given ConditionOp operator. Returns everything on and after the given ConditionOp.

§Examples

let mut a = Condition::new();
let cmap = ConditionMap::new();

a.insert(condop::ArnLike, cmap.clone());
a.insert(condop::Bool, cmap.clone());
a.insert(condop::DateEquals, cmap.clone());
a.insert(condop::NumericEquals, cmap.clone());
a.insert(condop::StringEquals, cmap.clone());

let b= a.split_off(&condop::DateEquals);
assert_eq!(a.len(), 2);
assert_eq!(b.len(), 3);

assert_eq!(a.into_keys().collect::<Vec<_>>(), vec![condop::ArnLike, condop::Bool]);
assert_eq!(b.into_keys().collect::<Vec<_>>(), vec![condop::DateEquals, condop::NumericEquals, condop::StringEquals]);
Source

pub fn values(&self) -> Values<'_, ConditionOp, ConditionMap>

Gets an iterator over the ConditionMap values of the map, in order by ConditionOp key.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
let cmap3 = ConditionMap::from_iter(vec![("c".to_string(), StringLikeList::<String>::from("C".to_string()))]);

condition.insert(condop::Bool, cmap2.clone());
condition.insert(condop::ArnLike, cmap1.clone());
condition.insert(condop::StringEquals, cmap3.clone());

let values: Vec<ConditionMap> = condition.values().cloned().collect();
assert_eq!(values, [cmap1, cmap2, cmap3]);
Source

pub fn values_mut(&mut self) -> ValuesMut<'_, ConditionOp, ConditionMap>

Gets an iterator over the mutable ConditionMap values of the map, in order by ConditionOp key.

§Examples

Basic usage:


let mut condition = Condition::new();
let cmap1 = ConditionMap::from_iter(vec![("a".to_string(), StringLikeList::<String>::from("A".to_string()))]);
let cmap2 = ConditionMap::from_iter(vec![("b".to_string(), StringLikeList::<String>::from("B".to_string()))]);
let cmap3 = ConditionMap::from_iter(vec![("c".to_string(), StringLikeList::<String>::from("C".to_string()))]);

condition.insert(condop::Bool, cmap2);
condition.insert(condop::ArnLike, cmap1);
condition.insert(condop::StringEquals, cmap3);

for value in condition.values_mut() {
   value.insert("d".to_string(), StringLikeList::<String>::from("D".to_string()));
}

assert_eq!(condition.get(&condop::ArnLike).unwrap().len(), 2);
Source

pub fn matches( &self, context: &Context, pv: PolicyVersion, ) -> Result<bool, AspenError>

Indicates whether this condition clause matches the request Context. This condition is interpreted using the specified PolicyVersion.

§Errors

If a condition clause contains a malformed variable, AspenError::InvalidSubstitution is returned.

Trait Implementations§

Source§

impl Clone for Condition

Source§

fn clone(&self) -> Condition

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 Debug for Condition

Source§

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

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

impl Default for Condition

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Condition

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Extend<(ConditionOp, BTreeMap<String, StringLikeList<String>>)> for Condition

Source§

fn extend<I>(&mut self, iter: I)

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<const N: usize> From<[(ConditionOp, BTreeMap<String, StringLikeList<String>>); N]> for Condition

Source§

fn from(array: [(ConditionOp, ConditionMap); N]) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<(ConditionOp, BTreeMap<String, StringLikeList<String>>)> for Condition

Source§

fn from_iter<I>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromStr for Condition

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<Q> Index<&Q> for Condition
where ConditionOp: Borrow<Q>, Q: Ord + ?Sized,

Source§

type Output = BTreeMap<String, StringLikeList<String>>

The returned type after indexing.
Source§

fn index(&self, key: &Q) -> &ConditionMap

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a> IntoIterator for &'a Condition

Source§

type Item = (&'a ConditionOp, &'a BTreeMap<String, StringLikeList<String>>)

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, ConditionOp, BTreeMap<String, StringLikeList<String>>>

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

fn into_iter(self) -> Iter<'a, ConditionOp, ConditionMap>

Creates an iterator from a value. Read more
Source§

impl<'a> IntoIterator for &'a mut Condition

Source§

type Item = (&'a ConditionOp, &'a mut BTreeMap<String, StringLikeList<String>>)

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, ConditionOp, BTreeMap<String, StringLikeList<String>>>

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

fn into_iter(self) -> IterMut<'a, ConditionOp, ConditionMap>

Creates an iterator from a value. Read more
Source§

impl IntoIterator for Condition

Source§

type Item = (ConditionOp, BTreeMap<String, StringLikeList<String>>)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<ConditionOp, BTreeMap<String, StringLikeList<String>>>

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

fn into_iter(self) -> IntoIter<ConditionOp, ConditionMap>

Creates an iterator from a value. Read more
Source§

impl PartialEq for Condition

Source§

fn eq(&self, other: &Condition) -> 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 Serialize for Condition

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Condition

Source§

impl StructuralPartialEq for Condition

Auto Trait Implementations§

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,