hir_ty

Struct Interner

source
pub struct Interner;

Trait Implementations§

source§

impl Clone for Interner

source§

fn clone(&self) -> Interner

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 Interner

source§

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

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

impl HasInterner for Interner

source§

type Interner = Interner

The interner associated with the type.
source§

impl Hash for Interner

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 Interner for Interner

source§

type InternedType = Interned<InternedWrapper<TyData<Interner>>>

“Interned” representation of types. In normal user code, Self::InternedType is not referenced. Instead, we refer to Ty<Self>, which wraps this type. Read more
source§

type InternedLifetime = Interned<InternedWrapper<LifetimeData<Interner>>>

“Interned” representation of lifetimes. In normal user code, Self::InternedLifetime is not referenced. Instead, we refer to Lifetime<Self>, which wraps this type. Read more
source§

type InternedConst = Interned<InternedWrapper<ConstData<Interner>>>

“Interned” representation of const expressions. In normal user code, Self::InternedConst is not referenced. Instead, we refer to Const<Self>, which wraps this type. Read more
source§

type InternedConcreteConst = ConstScalar

“Interned” representation of an evaluated const value. Self::InternedConcreteConst is not referenced. Instead, we refer to ConcreteConst<Self>, which wraps this type. Read more
source§

type InternedGenericArg = GenericArgData<Interner>

“Interned” representation of a “generic parameter”, which can be either a type or a lifetime. In normal user code, Self::InternedGenericArg is not referenced. Instead, we refer to GenericArg<Self>, which wraps this type. Read more
source§

type InternedGoal = Arc<GoalData<Interner>>

“Interned” representation of a “goal”. In normal user code, Self::InternedGoal is not referenced. Instead, we refer to Goal<Self>, which wraps this type. Read more
source§

type InternedGoals = Vec<Goal<Interner>>

“Interned” representation of a list of goals. In normal user code, Self::InternedGoals is not referenced. Instead, we refer to Goals<Self>, which wraps this type. Read more
source§

type InternedSubstitution = Interned<InternedWrapper<SmallVec<[GenericArg<Interner>; 2]>>>

“Interned” representation of a “substitution”. In normal user code, Self::InternedSubstitution is not referenced. Instead, we refer to Substitution<Self>, which wraps this type. Read more
source§

type InternedProgramClauses = Interned<InternedWrapper<Vec<ProgramClause<Interner>>>>

“Interned” representation of a list of program clauses. In normal user code, Self::InternedProgramClauses is not referenced. Instead, we refer to ProgramClauses<Self>, which wraps this type. Read more
source§

type InternedProgramClause = ProgramClauseData<Interner>

“Interned” representation of a “program clause”. In normal user code, Self::InternedProgramClause is not referenced. Instead, we refer to ProgramClause<Self>, which wraps this type. Read more
source§

type InternedQuantifiedWhereClauses = Interned<InternedWrapper<Vec<Binders<WhereClause<Interner>>>>>

“Interned” representation of a list of quantified where clauses. In normal user code, Self::InternedQuantifiedWhereClauses is not referenced. Instead, we refer to QuantifiedWhereClauses<Self>, which wraps this type. Read more
source§

type InternedVariableKinds = Interned<InternedWrapper<Vec<VariableKind<Interner>>>>

“Interned” representation of a list of variable kinds. In normal user code, Self::InternedVariableKinds is not referenced. Instead, we refer to VariableKinds<Self>, which wraps this type. Read more
source§

type InternedCanonicalVarKinds = Interned<InternedWrapper<Vec<WithKind<Interner, UniverseIndex>>>>

“Interned” representation of a list of variable kinds with universe index. In normal user code, Self::InternedCanonicalVarKinds is not referenced. Instead, we refer to CanonicalVarKinds<Self>, which wraps this type. Read more
source§

type InternedConstraints = Vec<InEnvironment<Constraint<Interner>>>

“Interned” representation of a list of region constraints. In normal user code, Self::InternedConstraints is not referenced. Instead, we refer to Constraints<Self>, which wraps this type. Read more
source§

type InternedVariances = SmallVec<[Variance; 16]>

“Interned” representation of a list of chalk_ir::Variance. In normal user code, Self::InternedVariances is not referenced. Instead, we refer to Variances<Self>, which wraps this type. Read more
source§

type DefId = InternId

The core “id” type used for trait-ids and the like.
source§

type InternedAdtId = AdtId

The ID type for ADTs
source§

type Identifier = TypeAliasId

Representation of identifiers.
source§

type FnAbi = FnAbi

Representation of function ABI (e.g. calling convention).
source§

fn debug_adt_id( type_kind_id: AdtId<Interner>, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a type-kind-id. Returns None to fallback to the default debug output.
source§

fn debug_trait_id( type_kind_id: TraitId<Interner>, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a type-kind-id. Returns None to fallback to the default debug output (e.g., if no info about current program is available from TLS).
source§

fn debug_assoc_type_id( id: AssocTypeId<Interner>, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a type-kind-id. Returns None to fallback to the default debug output.
source§

fn debug_opaque_ty_id( opaque_ty_id: OpaqueTyId, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of an opaque type. Returns None to fallback to the default debug output.
source§

fn debug_fn_def_id( fn_def_id: FnDefId, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a function-def-id. Returns None to fallback to the default debug output.
source§

fn debug_closure_id( _fn_def_id: ClosureId, _fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a closure id. Returns None to fallback to the default debug output.
source§

fn debug_alias(alias: &AliasTy, fmt: &mut Formatter<'_>) -> Option<Result>

Prints the debug representation of an alias. To get good results, this requires inspecting TLS, and is difficult to code without reference to a specific interner (and hence fully known types). Read more
source§

fn debug_projection_ty( proj: &ProjectionTy, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a ProjectionTy. Returns None to fallback to the default debug output.
source§

fn debug_opaque_ty( opaque_ty: &OpaqueTy, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of an OpaqueTy. Returns None to fallback to the default debug output.
source§

fn debug_ty(ty: &Ty, fmt: &mut Formatter<'_>) -> Option<Result>

Prints the debug representation of a type. Returns None to fallback to the default debug output.
source§

fn debug_lifetime( lifetime: &Lifetime, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a lifetime. Returns None to fallback to the default debug output.
source§

fn debug_const(constant: &Const, fmt: &mut Formatter<'_>) -> Option<Result>

Prints the debug representation of a const. Returns None to fallback to the default debug output.
source§

fn debug_generic_arg( parameter: &GenericArg, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of an parameter. Returns None to fallback to the default debug output.
source§

fn debug_variable_kinds( variable_kinds: &VariableKinds, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a parameter kinds list. Returns None to fallback to the default debug output.
source§

fn debug_variable_kinds_with_angles( variable_kinds: &VariableKinds, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a parameter kinds list, with angle brackets. Returns None to fallback to the default debug output.
source§

fn debug_canonical_var_kinds( canonical_var_kinds: &CanonicalVarKinds, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of an parameter kinds list with universe index. Returns None to fallback to the default debug output.
source§

fn debug_goal(goal: &Goal, fmt: &mut Formatter<'_>) -> Option<Result>

Prints the debug representation of an goal. Returns None to fallback to the default debug output.
source§

fn debug_goals(goals: &Goals, fmt: &mut Formatter<'_>) -> Option<Result>

Prints the debug representation of a list of goals. Returns None to fallback to the default debug output.
source§

fn debug_program_clause_implication( pci: &ProgramClauseImplication<Self>, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a ProgramClauseImplication. Returns None to fallback to the default debug output.
source§

fn debug_program_clause( clause: &ProgramClause, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a ProgramClause. Returns None to fallback to the default debug output.
source§

fn debug_program_clauses( clauses: &ProgramClauses, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a ProgramClauses. Returns None to fallback to the default debug output.
source§

fn debug_substitution( substitution: &Substitution, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a Substitution. Returns None to fallback to the default debug output.
source§

fn debug_separator_trait_ref( separator_trait_ref: &SeparatorTraitRef<'_, Interner>, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a SeparatorTraitRef. Returns None to fallback to the default debug output.
source§

fn debug_quantified_where_clauses( clauses: &QuantifiedWhereClauses, fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a QuantifiedWhereClauses. Returns None to fallback to the default debug output.
source§

fn debug_constraints( _clauses: &Constraints, _fmt: &mut Formatter<'_>, ) -> Option<Result>

Prints the debug representation of a Constraints. Returns None to fallback to the default debug output.
source§

fn intern_ty(self, kind: TyKind) -> Self::InternedType

Create an “interned” type from ty. This is not normally invoked directly; instead, you invoke TyKind::intern (which will ultimately call this method).
source§

fn ty_data(self, ty: &Self::InternedType) -> &TyData

Lookup the TyKind from an interned type.
source§

fn intern_lifetime(self, lifetime: LifetimeData) -> Self::InternedLifetime

Create an “interned” lifetime from lifetime. This is not normally invoked directly; instead, you invoke LifetimeData::intern (which will ultimately call this method).
source§

fn lifetime_data(self, lifetime: &Self::InternedLifetime) -> &LifetimeData

Lookup the LifetimeData that was interned to create a InternedLifetime.
source§

fn intern_const(self, constant: ConstData) -> Self::InternedConst

Create an “interned” const from const. This is not normally invoked directly; instead, you invoke ConstData::intern (which will ultimately call this method).
source§

fn const_data(self, constant: &Self::InternedConst) -> &ConstData

Lookup the ConstData that was interned to create a InternedConst.
source§

fn const_eq( self, _ty: &Self::InternedType, c1: &Self::InternedConcreteConst, c2: &Self::InternedConcreteConst, ) -> bool

Determine whether two concrete const values are equal.
source§

fn intern_generic_arg( self, parameter: GenericArgData, ) -> Self::InternedGenericArg

Create an “interned” parameter from data. This is not normally invoked directly; instead, you invoke GenericArgData::intern (which will ultimately call this method).
source§

fn generic_arg_data( self, parameter: &Self::InternedGenericArg, ) -> &GenericArgData

Lookup the LifetimeData that was interned to create a InternedLifetime.
source§

fn intern_goal(self, goal: GoalData) -> Self::InternedGoal

Create an “interned” goal from data. This is not normally invoked directly; instead, you invoke GoalData::intern (which will ultimately call this method).
source§

fn goal_data(self, goal: &Self::InternedGoal) -> &GoalData

Lookup the GoalData that was interned to create a InternedGoal.
source§

fn intern_goals<E>( self, data: impl IntoIterator<Item = Result<Goal, E>>, ) -> Result<Self::InternedGoals, E>

Create an “interned” goals from data. This is not normally invoked directly; instead, you invoke GoalsData::intern (which will ultimately call this method).
source§

fn goals_data(self, goals: &Self::InternedGoals) -> &[Goal]

Lookup the GoalsData that was interned to create a InternedGoals.
source§

fn intern_substitution<E>( self, data: impl IntoIterator<Item = Result<GenericArg, E>>, ) -> Result<Self::InternedSubstitution, E>

Create an “interned” substitution from data. This is not normally invoked directly; instead, you invoke SubstitutionData::intern (which will ultimately call this method).
source§

fn substitution_data( self, substitution: &Self::InternedSubstitution, ) -> &[GenericArg]

Lookup the SubstitutionData that was interned to create a InternedSubstitution.
source§

fn intern_program_clause( self, data: ProgramClauseData, ) -> Self::InternedProgramClause

Create an “interned” program clause from data. This is not normally invoked directly; instead, you invoke ProgramClauseData::intern (which will ultimately call this method).
source§

fn program_clause_data( self, clause: &Self::InternedProgramClause, ) -> &ProgramClauseData

Lookup the ProgramClauseData that was interned to create a ProgramClause.
source§

fn intern_program_clauses<E>( self, data: impl IntoIterator<Item = Result<ProgramClause, E>>, ) -> Result<Self::InternedProgramClauses, E>

Create an “interned” program clauses from data. This is not normally invoked directly; instead, you invoke ProgramClauses::from_iter (which will ultimately call this method).
source§

fn program_clauses_data( self, clauses: &Self::InternedProgramClauses, ) -> &[ProgramClause]

Lookup the ProgramClauseData that was interned to create a ProgramClause.
source§

fn intern_quantified_where_clauses<E>( self, data: impl IntoIterator<Item = Result<QuantifiedWhereClause, E>>, ) -> Result<Self::InternedQuantifiedWhereClauses, E>

Create an “interned” quantified where clauses from data. This is not normally invoked directly; instead, you invoke QuantifiedWhereClauses::from_iter (which will ultimately call this method).
source§

fn quantified_where_clauses_data( self, clauses: &Self::InternedQuantifiedWhereClauses, ) -> &[QuantifiedWhereClause]

Lookup the slice of QuantifiedWhereClause that was interned to create a QuantifiedWhereClauses.
source§

fn intern_generic_arg_kinds<E>( self, data: impl IntoIterator<Item = Result<VariableKind, E>>, ) -> Result<Self::InternedVariableKinds, E>

Create an “interned” parameter kinds from data. This is not normally invoked directly; instead, you invoke VariableKinds::from_iter (which will ultimately call this method).
source§

fn variable_kinds_data( self, parameter_kinds: &Self::InternedVariableKinds, ) -> &[VariableKind]

Lookup the slice of VariableKinds that was interned to create a VariableKinds.
source§

fn intern_canonical_var_kinds<E>( self, data: impl IntoIterator<Item = Result<CanonicalVarKind, E>>, ) -> Result<Self::InternedCanonicalVarKinds, E>

Create “interned” variable kinds with universe index from data. This is not normally invoked directly; instead, you invoke CanonicalVarKinds::from_iter (which will ultimately call this method).
source§

fn canonical_var_kinds_data( self, canonical_var_kinds: &Self::InternedCanonicalVarKinds, ) -> &[CanonicalVarKind]

Lookup the slice of CanonicalVariableKind that was interned to create a CanonicalVariableKinds.
source§

fn intern_constraints<E>( self, data: impl IntoIterator<Item = Result<InEnvironment<Constraint>, E>>, ) -> Result<Self::InternedConstraints, E>

Create “interned” constraints from data. This is not normally invoked dirctly; instead, you invoke Constraints::from_iter (which will ultimately call this method).
source§

fn constraints_data( self, constraints: &Self::InternedConstraints, ) -> &[InEnvironment<Constraint>]

Lookup the slice of Constraint that was interned to create a Constraints.
source§

fn intern_variances<E>( self, data: impl IntoIterator<Item = Result<Variance, E>>, ) -> Result<Self::InternedVariances, E>

Create “interned” variances from data. This is not normally invoked directly; instead, you invoke Variances::from (which will ultimately call this method).
source§

fn variances_data(self, variances: &Self::InternedVariances) -> &[Variance]

Lookup the slice of Variance that was interned to create a Variances.
§

fn debug_foreign_def_id( foreign_def_id: ForeignDefId<Self>, fmt: &mut Formatter<'_>, ) -> Option<Result<(), Error>>

Prints the debug representation of a foreign-def-id. Returns None to fallback to the default debug output.
§

fn debug_coroutine_id( coroutine_id: CoroutineId<Self>, fmt: &mut Formatter<'_>, ) -> Option<Result<(), Error>>

Prints the debug representation of an alias. Returns None to fallback to the default debug output.
§

fn debug_variances( variances: &Variances<Self>, fmt: &mut Formatter<'_>, ) -> Option<Result<(), Error>>

Prints the debug representation of a Variances. Returns None to fallback to the default debug output.
source§

impl Ord for Interner

source§

fn cmp(&self, other: &Interner) -> 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 PartialEq for Interner

source§

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

source§

fn partial_cmp(&self, other: &Interner) -> 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 TypeFoldable<Interner> for CallableSig

source§

fn try_fold_with<E>( self, folder: &mut dyn FallibleTypeFolder<Interner, Error = E>, outer_binder: DebruijnIndex, ) -> Result<Self, E>

Apply the given folder folder to self; binders is the number of binders that are in scope when beginning the folder. Typically binders starts as 0, but is adjusted when we encounter Binders<T> in the IR or other similar constructs.
§

fn fold_with( self, folder: &mut dyn TypeFolder<I, Error = Infallible>, outer_binder: DebruijnIndex, ) -> Self

A convenient alternative to try_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_fold_with.
source§

impl UnificationDatabase<Interner> for &dyn HirDatabase

source§

fn fn_def_variance(&self, fn_def_id: FnDefId<Interner>) -> Variances<Interner>

Gets the variances for the substitution of a fn def
source§

fn adt_variance(&self, adt_id: AdtId<Interner>) -> Variances<Interner>

Gets the variances for the substitution of a adt
source§

impl Copy for Interner

source§

impl Eq for Interner

source§

impl StructuralPartialEq for Interner

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
§

impl<T> Cast for T

§

fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U
where Self: CastTo<U>, U: HasInterner,

Cast a value to type U using CastTo.
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoBox<dyn Any> for T
where T: Any,

§

fn into_box(self) -> Box<dyn Any>

Convert self into the appropriate boxed form.
§

impl<T> IntoBox<dyn Any + Send> for T
where T: Any + Send,

§

fn into_box(self) -> Box<dyn Any + Send>

Convert self into the appropriate boxed form.
§

impl<T> IntoBox<dyn Any + Sync + Send> for T
where T: Any + Send + Sync,

§

fn into_box(self) -> Box<dyn Any + Sync + Send>

Convert self into the appropriate boxed form.
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<'a, T> Captures<'a> for T
where T: ?Sized,

source§

impl<N> NodeTrait for N
where N: Copy + Ord + Hash,