std.array.OutOfBounds
Valuetype pub copy OutOfBoundsAn error that signals an index is out of bounds.
Fields
index
let pub @index: IntThe index that is out of bounds.
size
let pub @size: IntThe size of the collection.
Static methods
new
Show source codeHide source code
fn pub static new(index: Int, size: Int) -> Self {
Self(index: index, size: size)
}fn pub static new(index: Int, size: Int) -> OutOfBoundsReturns a new OutOfBounds using the given index and collection size.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: ref Self) -> Bool {
!(self == other)
}fn pub !=(other: ref Self) -> BoolReturns true if self and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: Self) -> Bool {
@index == other.index and @size == other.size
}fn pub ==(other: OutOfBounds) -> 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.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
let obj = formatter.object('OutOfBounds')
obj.field('index', @index)
obj.field('size', @size)
obj.finish
}fn pub fmt(formatter: mut Formatter)Formats self in a human-readable format for debugging purposes.
to_string
Show source codeHide source code
fn pub to_string -> String {
'the index ${@index} is out of bounds (size: ${@size})'
}fn pub to_string -> StringConverts self to a String.
Implemented traits
Equal
impl Equal for OutOfBoundsFormat
impl Format for OutOfBoundsToString
impl ToString for OutOfBounds