FuelLabs/sway

Contract self impl

Open

#5.905 geöffnet am 23. Apr. 2024

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (5.421 Forks)batch import
ODHack12compiler: frontendcompiler: parsergood first issuelanguage featureteam:compiler

Repository-Metriken

Stars
 (61.702 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 4h) (19 gemergte PRs in 30 T)

Beschreibung

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 }
}

Contributor Guide