move icon indicating copy to clipboard operation
move copied to clipboard

[Feature Request] type alias

Open ChzenChzen opened this issue 1 year ago • 0 comments

🚀 Feature Request

add type alias feature in the way that it works in rust (with supporting generics definition)

Motivation

public entry fun mix_weapons(
        registry: &mut Registry<Weapons, String, Flavour<String>>,
        first_parent: &mut Weapon<Parent, String, String, String, String>,
        second_parent: &mut Weapon<Parent, String, String, String, String>,
        coin: Coin<JUICE>,
        ctx: &mut TxContext,
    )

Pitch

idea:

struct Foo<T, V> {
        bar: T,
        baz: V,
 }

type MyFoo<T> = Foo<T, String>;

example:

struct Parent {};
struct Weapons {};

type MyWeapon = Weapon<Parent, String, String, String, String>;
type MyRegistry = Registry<Weapons, String, Flavour<String>>;

public entry fun mix_weapons(
        registry: &mut MyRegistry,
        first_parent: &mut MyWeapon,
        second_parent: &mut MyWeapon,
        coin: Coin<JUICE>,
        ctx: &mut TxContext,
    )

ChzenChzen avatar Dec 08 '22 13:12 ChzenChzen