Lyricdev
GitHub

class Box

pub class Box<T>

Conforms to Equatable, Debug.

Holds a value behind a reference.

It is the indirection a value type needs to hold itself: enum Expr { Num(int), Add(Box<Expr>, Box<Expr>) } is finite where Add(Expr, Expr) is not. The box is shared, not copied; its value is fixed, so sharing is unobservable.

Fields

pub value: T

Methods

fn equals(o: Box<T>): bool
fn debug(): string

Returns the debug text of the held value; the box itself adds nothing.