Search results

There are no results.

std.array.OutOfBounds

Value
type pub copy OutOfBounds

An error that signals an index is out of bounds.

Fields

index

let pub @index: Int

The index that is out of bounds.

size

let pub @size: Int

The size of the collection.

Static methods

new

Show source code
Hide source code
fn pub static new(index: Int, size: Int) -> Self {
  Self(index: index, size: size)
}
fn pub static new(index: Int, size: Int) -> OutOfBounds

Returns a new OutOfBounds using the given index and collection size.

Instance methods

!=

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

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

==

Show source code
Hide source code
fn pub ==(other: Self) -> Bool {
  @index == other.index and @size == other.size
}
fn pub ==(other: OutOfBounds) -> 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.

fmt

Show source code
Hide 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 code
Hide source code
fn pub to_string -> String {
  'the index ${@index} is out of bounds (size: ${@size})'
}
fn pub to_string -> String

Converts self to a String.

Implemented traits

std.cmp.

Equal

impl Equal for OutOfBounds
std.fmt.

Format

impl Format for OutOfBounds
std.string.

ToString

impl ToString for OutOfBounds