std.nil.Nil
Valueclass pub builtin NilNil is used as a placeholder when no more meaningful type is present.
Nil is a regular type like any other. This means you can't just replace a
Nil with another type (i.e. it's not a nullable type). Instead, Nil is
used as a default/placeholder in a few places, such as method return types
when no type is specified explicitly.
Don't use Nil directly, instead use the Option type whenever you have
optional values.
Static methods
new
Show source codeHide source code
fn pub static new -> Nil {
nil
}fn pub static newReturns a new Nil.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: T) -> Bool {
(self == other).false?
}fn pub !=(other: T) -> BoolReturns true if self and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: ref Nil) -> Bool {
true
}fn pub ==(other: ref Nil) -> BoolReturns true if self and the given object are equal to each other.
This operator is used to perform structural equality. This means two objects residing in different memory locations may be considered equal, provided their structure is equal. For example, two different arrays may be considered to have structural equality if they contain the exact same values.
clone
Show source codeHide source code
fn pub clone -> Nil {
nil
}fn pub cloneCreates a clone of self.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
formatter.write('nil')
}fn pub fmt(formatter: mut Formatter)Formats self in a human-readable format for debugging purposes.
Implemented traits
Clone
impl Clone[Nil] for NilEqual
impl Equal[ref Nil] for NilFormat
impl Format for Nil