pub struct GenericParams {
pub regions: Vector<RegionId, RegionVar>,
pub types: Vector<TypeVarId, TypeVar>,
pub const_generics: Vector<ConstGenericVarId, ConstGenericVar>,
pub trait_clauses: Vector<TraitClauseId, TraitClause>,
pub regions_outlive: Vec<RegionBinder<RegionOutlives>>,
pub types_outlive: Vec<RegionBinder<TypeOutlives>>,
pub trait_type_constraints: Vec<RegionBinder<TraitTypeConstraint>>,
}
Expand description
Generic parameters for a declaration. We group the generics which come from the Rust compiler substitutions (the regions, types and const generics) as well as the trait clauses. The reason is that we consider that those are parameters that need to be filled. We group in a different place the predicates which are not trait clauses, because those enforce constraints but do not need to be filled with witnesses/instances.
Fields§
§regions: Vector<RegionId, RegionVar>
§types: Vector<TypeVarId, TypeVar>
§const_generics: Vector<ConstGenericVarId, ConstGenericVar>
§trait_clauses: Vector<TraitClauseId, TraitClause>
§regions_outlive: Vec<RegionBinder<RegionOutlives>>
The first region in the pair outlives the second region
types_outlive: Vec<RegionBinder<TypeOutlives>>
The type outlives the region
trait_type_constraints: Vec<RegionBinder<TraitTypeConstraint>>
Constraints over trait associated types
Implementations§
source§impl GenericParams
impl GenericParams
pub fn empty() -> Self
pub fn is_empty(&self) -> bool
pub fn has_predicates(&self) -> bool
pub fn len(&self) -> usize
sourcepub fn identity_args(&self) -> GenericArgs
pub fn identity_args(&self) -> GenericArgs
Construct a set of generic arguments in the scope of self
that matches self
and feeds
each required parameter with itself. E.g. given parameters for <T, U> where U: PartialEq<T>
, the arguments would be <T, U>[@TraitClause0]
.
sourcepub fn split(&self, info: &ParamsInfo) -> (Self, Self)
pub fn split(&self, info: &ParamsInfo) -> (Self, Self)
Split these params in two, according to the provided ParamsInfo
.
source§impl GenericParams
impl GenericParams
pub fn fmt_with_ctx_with_trait_clauses<C>(
&self,
ctx: &C,
tab: &str,
info: &Option<ParamsInfo>,
) -> (String, String, bool)where
C: AstFormatter,
fn format_clauses<C>(&self, ctx: &C, tab: &str) -> Stringwhere
C: AstFormatter,
sourcepub fn fmt_where_clauses(
tab: &str,
num_parent_clauses: usize,
clauses: Vec<String>,
) -> String
pub fn fmt_where_clauses( tab: &str, num_parent_clauses: usize, clauses: Vec<String>, ) -> String
[num_parent_clauses]: we store in the definitions all the clauses they have access to, which includes the clauses inherited from the parent. This can be confusing: we insert a delimiter between the inherited clauses and the local clauses.
Trait Implementations§
source§impl Clone for GenericParams
impl Clone for GenericParams
source§fn clone(&self) -> GenericParams
fn clone(&self) -> GenericParams
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GenericParams
impl Debug for GenericParams
source§impl Default for GenericParams
impl Default for GenericParams
source§fn default() -> GenericParams
fn default() -> GenericParams
source§impl<'de> Deserialize<'de> for GenericParams
impl<'de> Deserialize<'de> for GenericParams
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl DriveMut for GenericParams
impl DriveMut for GenericParams
source§impl<C: AstFormatter> FmtWithCtx<C> for GenericParams
impl<C: AstFormatter> FmtWithCtx<C> for GenericParams
source§impl PartialEq for GenericParams
impl PartialEq for GenericParams
source§impl Serialize for GenericParams
impl Serialize for GenericParams
impl Eq for GenericParams
impl StructuralPartialEq for GenericParams
Auto Trait Implementations§
impl Freeze for GenericParams
impl RefUnwindSafe for GenericParams
impl Send for GenericParams
impl Sync for GenericParams
impl Unpin for GenericParams
impl UnwindSafe for GenericParams
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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