FuelLabs/sway

Contract self impl

Open

#5905 aperta il 23 apr 2024

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Rust (5421 fork)batch import
ODHack12compiler: frontendcompiler: parsergood first issuelanguage featureteam:compiler

Metriche repository

Star
 (61.702 star)
Metriche merge PR
 (Merge medio 22h 6m) (16 PR mergiate in 30 g)

Descrizione

Allow self impl for contracts as a shorthand for an anonymous ABI spec. The point is to not have to write an ABI type for very small contracts.

This:

contract;
impl Contract {
    fn foo() -> u64 { 0 }
}

Should produce the same binary and ABI spec as:

contract;
abi MyAbi {
    fn foo() -> u64;
}
impl MyAbi for Contract {
    fn foo() -> u64 { 0 }
}

Guida contributor