Trait gut::index::CheckedIndex [−][src]
A trait that defines what it means for an index to be a checked index. In other words implementers are indices that are checked for validity in some way.
Required methods
fn invalid() -> Self
[src]
Construct an invalid index.
fn is_valid(&self) -> bool
[src]
Check if the index is valid.
fn unwrap(self) -> T
[src]
Convert the index into its underlying integer type. Panic if index is invalid.
fn expect(self, msg: &str) -> T
[src]
Convert the index into its underlying integer type. In case of failure, report the given message.
fn map<F: FnOnce(T) -> T>(self, f: F) -> Self
[src]
Map the underlying integer type. This allows restricting operations to valid indices only.
fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U
[src]
Map the underlying integer type. If the index is invalid, output the provided default.
fn into_inner(self) -> T
[src]
Produce the raw inner type without checking.