pub struct GenericSubstitution<'db> { /* private fields */ }Expand description
A substitution of generic arguments in generic parameters as well as the Self of traits. Used
for concretization.
Implementations§
Source§impl<'db> GenericSubstitution<'db>
impl<'db> GenericSubstitution<'db>
pub fn from_impl(self_impl: ImplId<'db>) -> Self
pub fn new( generic_params: &[GenericParam<'db>], generic_args: &[GenericArgumentId<'db>], ) -> Self
pub fn concat(self, other: GenericSubstitution<'db>) -> Self
pub fn substitute<'a, 'r, Obj>( &'r self, db: &'a dyn Database, obj: Obj, ) -> Maybe<Obj>
Methods from Deref<Target = OrderedHashMap<GenericParamId<'db>, GenericArgumentId<'db>>>§
Sourcepub fn iter(&self) -> Iter<'_, Key, Value>
pub fn iter(&self) -> Iter<'_, Key, Value>
Returns an iterator over the key-value pairs of the map, in their order.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, Key, Value>
pub fn iter_mut(&mut self) -> IterMut<'_, Key, Value>
Returns a mutable iterator over the key-value pairs of the map, in their order.
Sourcepub fn keys(&self) -> Keys<'_, Key, Value>
pub fn keys(&self) -> Keys<'_, Key, Value>
Returns an iterator over the keys of the map, in their order.
Sourcepub fn values(&self) -> Values<'_, Key, Value>
pub fn values(&self) -> Values<'_, Key, Value>
Returns an iterator over the values of the map, in their order.
Sourcepub fn shift_remove_index(&mut self, index: usize) -> Option<(Key, Value)>
pub fn shift_remove_index(&mut self, index: usize) -> Option<(Key, Value)>
Removes the entry at the given index.
Returns the key-value pair at the given index (if present).
Sourcepub fn get<Q>(&self, key: &Q) -> Option<&Value>
pub fn get<Q>(&self, key: &Q) -> Option<&Value>
Returns a reference to the value stored for key, if it is present, else None.
Computes in O(1) time (average).
Sourcepub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>
Returns a mutable reference to the value stored for key, if it is present, else None.
Computes in O(1) time (average).
Sourcepub fn entry(&mut self, key: Key) -> Entry<'_, Key, Value>
pub fn entry(&mut self, key: Key) -> Entry<'_, Key, Value>
Gets the given key’s corresponding entry in the map for insertion and/or in-place manipulation.
Computes in O(1) time (amortized average).
Sourcepub fn insert(&mut self, key: Key, value: Value) -> Option<Value>
pub fn insert(&mut self, key: Key, value: Value) -> Option<Value>
Insert a key-value pair in the map.
If an equivalent key already exists in the map: the key remains and retains in its place in the order, its corresponding value is updated with value and the older value is returned inside Some(_).
If no equivalent key existed in the map: the new key-value pair is inserted, last in order, and None is returned.
Computes in O(1) time (amortized average).
See also entry if you want to insert or modify or if you need to get the index of the corresponding key-value pair.
Sourcepub fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = (Key, Value)>,
pub fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = (Key, Value)>,
Extends the map with the content of the given iterator.
Sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Returns true if an equivalent to key exists in the map.
Sourcepub fn shift_remove<Q>(&mut self, key: &Q) -> Option<Value>
pub fn shift_remove<Q>(&mut self, key: &Q) -> Option<Value>
Removes the entry for the given key, preserving the order of entries.
Returns the value associated with the key (if present).
Sourcepub fn swap_remove<Q>(&mut self, key: &Q) -> Option<Value>
pub fn swap_remove<Q>(&mut self, key: &Q) -> Option<Value>
Removes the entry for the given key by swapping it with the last element. Thus the order of elements is not preserved, but the resulting order is still deterministic.
Returns the value associated with the key (if present).
Sourcepub fn retain(&mut self, keep: impl FnMut(&Key, &mut Value) -> bool)
pub fn retain(&mut self, keep: impl FnMut(&Key, &mut Value) -> bool)
Scan through each key-value pair in the map and keep those where the
closure keep returns true.
The elements are visited in order, and remaining elements keep their order.
Computes in O(n) time (average).
Sourcepub fn eq_unordered(&self, other: &OrderedHashMap<Key, Value, BH>) -> boolwhere
Value: Eq,
pub fn eq_unordered(&self, other: &OrderedHashMap<Key, Value, BH>) -> boolwhere
Value: Eq,
Returns true if the maps are equal, ignoring the order of the entries.
Trait Implementations§
Source§impl<'db> Clone for GenericSubstitution<'db>
impl<'db> Clone for GenericSubstitution<'db>
Source§fn clone(&self) -> GenericSubstitution<'db>
fn clone(&self) -> GenericSubstitution<'db>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'db> Debug for GenericSubstitution<'db>
impl<'db> Debug for GenericSubstitution<'db>
Source§impl<'db> Default for GenericSubstitution<'db>
impl<'db> Default for GenericSubstitution<'db>
Source§fn default() -> GenericSubstitution<'db>
fn default() -> GenericSubstitution<'db>
Source§impl<'db> Deref for GenericSubstitution<'db>
impl<'db> Deref for GenericSubstitution<'db>
Source§type Target = OrderedHashMap<GenericParamId<'db>, GenericArgumentId<'db>>
type Target = OrderedHashMap<GenericParamId<'db>, GenericArgumentId<'db>>
Source§impl<'db> DerefMut for GenericSubstitution<'db>
impl<'db> DerefMut for GenericSubstitution<'db>
Source§impl<'db> Hash for GenericSubstitution<'db>
impl<'db> Hash for GenericSubstitution<'db>
Source§impl<'db> PartialEq for GenericSubstitution<'db>
impl<'db> PartialEq for GenericSubstitution<'db>
Source§impl<'db> Update for GenericSubstitution<'db>
impl<'db> Update for GenericSubstitution<'db>
impl<'db> Eq for GenericSubstitution<'db>
impl<'db> StructuralPartialEq for GenericSubstitution<'db>
Auto Trait Implementations§
impl<'db> Freeze for GenericSubstitution<'db>
impl<'db> RefUnwindSafe for GenericSubstitution<'db>
impl<'db> Send for GenericSubstitution<'db>
impl<'db> Sync for GenericSubstitution<'db>
impl<'db> Unpin for GenericSubstitution<'db>
impl<'db> UnwindSafe for GenericSubstitution<'db>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
fn debug_db_upcast(&'db self) -> &'db T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more