mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-26 19:48:01 +02:00
Added nullable(T), Result<T> can use null conditionals
This commit is contained in:
parent
336226d686
commit
68bf7bc801
19 changed files with 343 additions and 210 deletions
|
@ -59,6 +59,15 @@ namespace System
|
|||
return default(T);
|
||||
}
|
||||
|
||||
public static nullable(T) operator?(Self val)
|
||||
{
|
||||
switch (val)
|
||||
{
|
||||
case .Ok(let inner): return inner;
|
||||
case .Err: return null;
|
||||
}
|
||||
}
|
||||
|
||||
[SkipCall]
|
||||
public void Dispose()
|
||||
{
|
||||
|
@ -151,6 +160,15 @@ namespace System
|
|||
return default(T);
|
||||
}
|
||||
|
||||
public static nullable(T) operator?(Self val)
|
||||
{
|
||||
switch (val)
|
||||
{
|
||||
case .Ok(let inner): return inner;
|
||||
case .Err: return null;
|
||||
}
|
||||
}
|
||||
|
||||
[SkipCall]
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue