-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dave Huseby <dwh@linuxprogrammer.org>
- Loading branch information
Showing
3 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// This trait is for multiformat objects that have a NULL value | ||
pub trait Null { | ||
/// return an instance of Self where is_null(&self) -> true | ||
fn null() -> Self; | ||
/// verify if self is the null value | ||
fn is_null(&self) -> bool; | ||
} | ||
|
||
/// This trait is a fallible version of Null | ||
pub trait TryNull: Sized { | ||
/// the error type to return when constructing a null value fails | ||
type Error; | ||
|
||
/// try to construct a Null value of Self | ||
fn try_null() -> Result<Self, Self::Error>; | ||
/// verify if self is the null value | ||
fn is_null(&self) -> bool; | ||
} |