Files
c3c/lib/std/collections/maybe.c3
2024-10-08 11:02:10 +02:00

20 lines
283 B
Plaintext

module std::collections::maybe(<Type>);
struct Maybe
{
Type value;
bool has_value;
}
fn Maybe value(Type val)
{
return { .value = val, .has_value = true };
}
const Maybe EMPTY = { };
macro Type! Maybe.get(self)
{
return self.has_value ? self.value : SearchResult.MISSING?;
}