pub struct Annotation<'ast> {
pub typ: Option<Type<'ast>>,
pub contracts: &'ast [Type<'ast>],
}Expand description
A type and/or contract annotation.
Fields§
§typ: Option<Type<'ast>>The type annotation (using :).
contracts: &'ast [Type<'ast>]The contract annotations (using |).
Implementations§
Source§impl Annotation<'_>
impl Annotation<'_>
Sourcepub fn contracts_to_string(&self) -> Option<String>
pub fn contracts_to_string(&self) -> Option<String>
Returns a string representation of the contracts (without the static type annotation) as a comma-separated list.
Trait Implementations§
Source§impl<'ast> AttachToAst<'ast, Ast<'ast>> for Annotation<'ast>
impl<'ast> AttachToAst<'ast, Ast<'ast>> for Annotation<'ast>
Source§impl<'ast> Clone for Annotation<'ast>
impl<'ast> Clone for Annotation<'ast>
Source§fn clone(&self) -> Annotation<'ast>
fn clone(&self) -> Annotation<'ast>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CloneTo for Annotation<'_>
impl CloneTo for Annotation<'_>
Source§type Data<'ast> = Annotation<'ast>
type Data<'ast> = Annotation<'ast>
Self, be we need associated types to make Rust understand that Self is
always parametric over the 'ast lifetime. We’re using GATs to emulate higher-kinded
types.Source§impl<'ast> Combine<'ast> for Annotation<'ast>
impl<'ast> Combine<'ast> for Annotation<'ast>
Source§fn combine(alloc: &'ast AstAlloc, left: Self, right: Self) -> Self
fn combine(alloc: &'ast AstAlloc, left: Self, right: Self) -> Self
Combine two annotations. If both have types set, the final type
is the one of the left annotation, while the right one’s type is put
inside the final contracts.
Contracts are combined from left to right; the left one’s are put first, then maybe the right one’s type annotation and then the right one’s contracts.
Source§impl<'ast> CombineAlloc<'ast> for Annotation<'ast>
impl<'ast> CombineAlloc<'ast> for Annotation<'ast>
Source§fn combine(alloc: &'ast AstAlloc, left: Self, right: Self) -> Self
fn combine(alloc: &'ast AstAlloc, left: Self, right: Self) -> Self
Combine two annotations. If both have types set, the final type
is the one of the left annotation, while the right one’s type is put
inside the final contracts.
Contracts are combined from left to right; the left one’s are put first, then maybe the right one’s type annotation and then the right one’s contracts.
Source§impl<'ast> Debug for Annotation<'ast>
impl<'ast> Debug for Annotation<'ast>
Source§impl<'ast> Default for Annotation<'ast>
impl<'ast> Default for Annotation<'ast>
Source§fn default() -> Annotation<'ast>
fn default() -> Annotation<'ast>
Source§impl<'ast> From<Annotation<'ast>> for FieldMetadata<'ast>
impl<'ast> From<Annotation<'ast>> for FieldMetadata<'ast>
Source§fn from(annotation: Annotation<'ast>) -> Self
fn from(annotation: Annotation<'ast>) -> Self
Source§impl<'ast> PartialEq for Annotation<'ast>
impl<'ast> PartialEq for Annotation<'ast>
Source§impl<'a> Pretty<'a, Allocator> for &Annotation<'_>
impl<'a> Pretty<'a, Allocator> for &Annotation<'_>
Source§impl<'ast> TraverseAlloc<'ast, Ast<'ast>> for Annotation<'ast>
impl<'ast> TraverseAlloc<'ast, Ast<'ast>> for Annotation<'ast>
Source§fn traverse<F, E>(
self,
alloc: &'ast AstAlloc,
f: &mut F,
order: TraverseOrder,
) -> Result<Self, E>
fn traverse<F, E>( self, alloc: &'ast AstAlloc, f: &mut F, order: TraverseOrder, ) -> Result<Self, E>
Source§fn traverse_ref<S, U>(
&'ast self,
f: &mut dyn FnMut(&'ast Ast<'ast>, &S) -> TraverseControl<S, U>,
scope: &S,
) -> Option<U>
fn traverse_ref<S, U>( &'ast self, f: &mut dyn FnMut(&'ast Ast<'ast>, &S) -> TraverseControl<S, U>, scope: &S, ) -> Option<U>
fn find_map<S>(&'ast self, pred: impl FnMut(&'ast T) -> Option<S>) -> Option<S>where
T: Clone + 'ast,
impl Allocable for Annotation<'_>
impl<'ast> Eq for Annotation<'ast>
impl<'ast> StructuralPartialEq for Annotation<'ast>
Auto Trait Implementations§
impl<'ast> Freeze for Annotation<'ast>
impl<'ast> RefUnwindSafe for Annotation<'ast>
impl<'ast> Send for Annotation<'ast>
impl<'ast> Sync for Annotation<'ast>
impl<'ast> Unpin for Annotation<'ast>
impl<'ast> UnsafeUnpin for Annotation<'ast>
impl<'ast> UnwindSafe for Annotation<'ast>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> 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