indexing 0.1.0-alpha.4

Sound unchecked indexing using “generativity”; a type system approach to indices and ranges that are trusted to be in bounds.
Documentation
use std::fmt;
use std::error::Error;

/// Error produced when an indexing operation is out of bounds or otherwise
/// inapplicable.
///
/// Carries no context information (to be as light as possible).
#[derive(Copy, Debug, PartialEq)]
pub struct IndexingError(());

#[inline]
pub fn index_error() -> IndexingError {
    IndexingError(())
}

impl Clone for IndexingError {
    fn clone(&self) -> Self { *self }
}

impl Error for IndexingError {
    fn description(&self) -> &str {
        "index error"
    }
}

impl fmt::Display for IndexingError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str(self.description())
    }
}