pub struct ImplicitPrecedence<'db>(/* private fields */);Expand description
Extra information about sorting of implicit arguments of the function.
In most of the user written code, the implicits are not stated explicitly, but instead are inferred by the compiler. The order on how these implicit arguments are laid out on Sierra level is unspecified though for the users. Currently, the compiler sorts them alphabetically by name for reproducibility, but it can equally just randomize the order on each compilation.
Some compilation targets tend to expect that particular functions accept particular implicit arguments at fixed positions. For example, the Starknet OS has such assumptions. By reading the implicit precedence information attached to functions, the compiler can now reliably generate compatible code.
To set, add the #[implicit_precedence(...)] attribute to function declaration. Only free or
impl functions can have this information defined. For extern functions, the compiler raises an
error. It is recommended to always create this attribute from compiler plugins, and not force
users to write it manually.
Use ImplicitPrecedence::UNSPECIFIED to represent lack of information.
Implementations§
Source§impl<'db> ImplicitPrecedence<'db>
impl<'db> ImplicitPrecedence<'db>
Sourcepub const UNSPECIFIED: Self
pub const UNSPECIFIED: Self
A precedence that does not actually prefer any implicit.
When applied to a sequence of implicits, they will just be reordered alphabetically.
Trait Implementations§
Source§impl<'db> Clone for ImplicitPrecedence<'db>
impl<'db> Clone for ImplicitPrecedence<'db>
Source§fn clone(&self) -> ImplicitPrecedence<'db>
fn clone(&self) -> ImplicitPrecedence<'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 ImplicitPrecedence<'db>
impl<'db> Debug for ImplicitPrecedence<'db>
Source§impl<'db> Default for ImplicitPrecedence<'db>
impl<'db> Default for ImplicitPrecedence<'db>
Source§fn default() -> ImplicitPrecedence<'db>
fn default() -> ImplicitPrecedence<'db>
Source§impl<'db> FromIterator<TypeId<'db>> for ImplicitPrecedence<'db>
impl<'db> FromIterator<TypeId<'db>> for ImplicitPrecedence<'db>
Source§impl<'db> PartialEq for ImplicitPrecedence<'db>
impl<'db> PartialEq for ImplicitPrecedence<'db>
Source§impl<'db> Update for ImplicitPrecedence<'db>
impl<'db> Update for ImplicitPrecedence<'db>
impl<'db> Eq for ImplicitPrecedence<'db>
impl<'db> StructuralPartialEq for ImplicitPrecedence<'db>
Auto Trait Implementations§
impl<'db> Freeze for ImplicitPrecedence<'db>
impl<'db> RefUnwindSafe for ImplicitPrecedence<'db>
impl<'db> Send for ImplicitPrecedence<'db>
impl<'db> Sync for ImplicitPrecedence<'db>
impl<'db> Unpin for ImplicitPrecedence<'db>
impl<'db> UnwindSafe for ImplicitPrecedence<'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