Skip to content

feat: Add type util tools #70

@Zffu

Description

@Zffu

Add tools in order to compare types at compile time! And potentially at runtime

Example:

enum myEnum { 
 bob,
 eq
 } 

var myEnum enumInst

// Safe unwrap (uses runtime checks
if (unwrap<enumInst, myEnum::bob> => unwrapped) {

}

// Unsafe unwrap (doesn't check anything)
if(unsafe_unwrap<enumInst, myEnum::bob> => unwrapped) {

}

var myEnum::bob test = unwrap<enumInst>
var myEnum::bob test2 = unwrap_unsafe<enumInst>

Furthermore, the unwrap and unsafe_unwrap operators can be used to directly extract the value. The unwrap operator will then cause a safety trap call

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions