pub struct TyFunctionDeclaration {
pub name: Ident,
pub body: TyCodeBlock,
pub parameters: Vec<TyFunctionParameter>,
pub span: Span,
pub attributes: AttributesMap,
pub return_type: TypeId,
pub initial_return_type: TypeId,
pub type_parameters: Vec<TypeParameter>,
pub return_type_span: Span,
/* private fields */
}
Fields
name: Ident
body: TyCodeBlock
parameters: Vec<TyFunctionParameter>
span: Span
attributes: AttributesMap
return_type: TypeId
initial_return_type: TypeId
type_parameters: Vec<TypeParameter>
return_type_span: Span
Used for error messages – the span pointing to the return type annotation of the function
Implementations
sourceimpl TyFunctionDeclaration
impl TyFunctionDeclaration
pub fn to_fn_selector_value_untruncated(&self) -> CompileResult<Vec<u8>>
sourcepub fn to_fn_selector_value(&self) -> CompileResult<[u8; 4]>
pub fn to_fn_selector_value(&self) -> CompileResult<[u8; 4]>
Converts a TyFunctionDeclaration into a value that is to be used in contract function selectors. Hashes the name and parameters using SHA256, and then truncates to four bytes.
pub fn to_selector_name(&self) -> CompileResult<String>
sourceimpl TyFunctionDeclaration
impl TyFunctionDeclaration
pub fn type_check(
ctx: TypeCheckContext<'_>,
fn_decl: FunctionDeclaration,
is_method: bool
) -> CompileResult<Self>
Trait Implementations
sourceimpl Clone for TyFunctionDeclaration
impl Clone for TyFunctionDeclaration
sourcefn clone(&self) -> TyFunctionDeclaration
fn clone(&self) -> TyFunctionDeclaration
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for TyFunctionDeclaration
impl Debug for TyFunctionDeclaration
sourceimpl From<&TyFunctionDeclaration> for TyAstNode
impl From<&TyFunctionDeclaration> for TyAstNode
sourcefn from(o: &TyFunctionDeclaration) -> Self
fn from(o: &TyFunctionDeclaration) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<TyFunctionDeclaration> for TyFunctionDeclaration
impl PartialEq<TyFunctionDeclaration> for TyFunctionDeclaration
impl Eq for TyFunctionDeclaration
impl StructuralEq for TyFunctionDeclaration
Auto Trait Implementations
impl RefUnwindSafe for TyFunctionDeclaration
impl Send for TyFunctionDeclaration
impl Sync for TyFunctionDeclaration
impl Unpin for TyFunctionDeclaration
impl UnwindSafe for TyFunctionDeclaration
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.