pub trait IntoQueryKey<K> {
// Required method
fn into_query_key(self) -> K;
}Expand description
Argument-conversion trait used by some queries and other TyCtxt methods.
A function that accepts an impl IntoQueryKey<DefId> argument can be thought
of as taking a DefId, except that callers can also pass a LocalDefId
or values of other narrower ID types, as long as they have a trivial conversion
to DefId.
Using a dedicated trait instead of Into makes the purpose of the conversion
more explicit, and makes occurrences easier to search for.
Required Methods§
Sourcefn into_query_key(self) -> K
fn into_query_key(self) -> K
Argument conversion from Self to K.
This should always be a very cheap conversion, e.g. LocalDefId::to_def_id.
Implementations on Foreign Types§
Source§impl IntoQueryKey<DefId> for OwnerId
impl IntoQueryKey<DefId> for OwnerId
fn into_query_key(self) -> DefId
Source§impl IntoQueryKey<DefId> for LocalDefId
impl IntoQueryKey<DefId> for LocalDefId
fn into_query_key(self) -> DefId
Source§impl IntoQueryKey<DefId> for LocalModDefId
impl IntoQueryKey<DefId> for LocalModDefId
fn into_query_key(self) -> DefId
Source§impl IntoQueryKey<DefId> for ModDefId
impl IntoQueryKey<DefId> for ModDefId
fn into_query_key(self) -> DefId
Source§impl IntoQueryKey<LocalDefId> for OwnerId
impl IntoQueryKey<LocalDefId> for OwnerId
fn into_query_key(self) -> LocalDefId
Source§impl IntoQueryKey<LocalDefId> for LocalModDefId
impl IntoQueryKey<LocalDefId> for LocalModDefId
fn into_query_key(self) -> LocalDefId
Implementors§
impl<K> IntoQueryKey<K> for K
Any type can be converted to itself.
This is useful in generic or macro-generated code where we don’t know whether conversion is actually needed, so that we can do a conversion unconditionally.