Search results

There are no results.

std.nil.Nil

Value
class pub builtin Nil

Nil 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 code
Hide source code
fn pub static new -> Nil {
  nil
}
fn pub static new

Returns a new Nil.

Instance methods

!=

Show source code
Hide source code
fn pub !=(other: T) -> Bool {
  (self == other).false?
}
fn pub !=(other: T) -> Bool

Returns true if self and the given object are not equal to each other.

==

Show source code
Hide source code
fn pub ==(other: ref Nil) -> Bool {
  true
}
fn pub ==(other: ref Nil) -> Bool

Returns 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 code
Hide source code
fn pub clone -> Nil {
  nil
}
fn pub clone

Creates a clone of self.

fmt

Show source code
Hide 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

std.clone.

Clone

impl Clone[Nil] for Nil
std.cmp.

Equal

impl Equal[ref Nil] for Nil
std.fmt.

Format

impl Format for Nil