Struct sway_core::TypedFunctionDeclaration
source · [−]pub struct TypedFunctionDeclaration {
pub name: Ident,
pub body: TypedCodeBlock,
pub parameters: Vec<TypedFunctionParameter>,
pub span: Span,
pub return_type: TypeId,
pub initial_return_type: TypeId,
pub type_parameters: Vec<TypeParameter>,
pub return_type_span: Span,
/* private fields */
}Fields
name: Identbody: TypedCodeBlockparameters: Vec<TypedFunctionParameter>span: Spanreturn_type: TypeIdinitial_return_type: TypeIdtype_parameters: Vec<TypeParameter>return_type_span: SpanUsed for error messages – the span pointing to the return type annotation of the function
Implementations
sourceimpl TypedFunctionDeclaration
impl TypedFunctionDeclaration
pub fn type_check(
ctx: TypeCheckContext<'_>,
fn_decl: FunctionDeclaration
) -> CompileResult<Self>
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 TypedFunctionDeclaration 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>
Trait Implementations
sourceimpl Clone for TypedFunctionDeclaration
impl Clone for TypedFunctionDeclaration
sourcefn clone(&self) -> TypedFunctionDeclaration
fn clone(&self) -> TypedFunctionDeclaration
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for TypedFunctionDeclaration
impl Debug for TypedFunctionDeclaration
sourceimpl From<&TypedFunctionDeclaration> for TypedAstNode
impl From<&TypedFunctionDeclaration> for TypedAstNode
sourcefn from(o: &TypedFunctionDeclaration) -> Self
fn from(o: &TypedFunctionDeclaration) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<TypedFunctionDeclaration> for TypedFunctionDeclaration
impl PartialEq<TypedFunctionDeclaration> for TypedFunctionDeclaration
impl Eq for TypedFunctionDeclaration
impl StructuralEq for TypedFunctionDeclaration
Auto Trait Implementations
impl RefUnwindSafe for TypedFunctionDeclaration
impl Send for TypedFunctionDeclaration
impl Sync for TypedFunctionDeclaration
impl Unpin for TypedFunctionDeclaration
impl UnwindSafe for TypedFunctionDeclaration
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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 Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
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.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more