#[non_exhaustive]
pub enum Error {
ByteIndexOutOfBounds(usize, usize),
CharIndexOutOfBounds(usize, usize),
LineIndexOutOfBounds(usize, usize),
Utf16IndexOutOfBounds(usize, usize),
ByteIndexNotCharBoundary(usize),
ByteRangeNotCharBoundary(Option<usize>, Option<usize>),
ByteRangeInvalid(usize, usize),
CharRangeInvalid(usize, usize),
ByteRangeOutOfBounds(Option<usize>, Option<usize>, usize),
CharRangeOutOfBounds(Option<usize>, Option<usize>, usize),
}
Expand description
Ropey’s error type.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
ByteIndexOutOfBounds(usize, usize)
Indicates that the passed byte index was out of bounds.
Contains the index attempted and the actual length of the
Rope
/RopeSlice
in bytes, in that order.
CharIndexOutOfBounds(usize, usize)
Indicates that the passed char index was out of bounds.
Contains the index attempted and the actual length of the
Rope
/RopeSlice
in chars, in that order.
LineIndexOutOfBounds(usize, usize)
Indicates that the passed line index was out of bounds.
Contains the index attempted and the actual length of the
Rope
/RopeSlice
in lines, in that order.
Utf16IndexOutOfBounds(usize, usize)
Indicates that the passed utf16 code-unit index was out of bounds.
Contains the index attempted and the actual length of the
Rope
/RopeSlice
in utf16 code units, in that order.
ByteIndexNotCharBoundary(usize)
Indicates that the passed byte index was not a char boundary.
Contains the passed byte index.
ByteRangeNotCharBoundary(Option<usize>, Option<usize>)
Indicates that the passed byte range didn’t line up with char boundaries.
Contains the [start, end) byte indices of the range, in that order.
When either the start or end are None
, that indicates a half-open
range.
ByteRangeInvalid(usize, usize)
Indicates that a reversed byte-index range (end < start) was encountered.
Contains the [start, end) byte indices of the range, in that order.
CharRangeInvalid(usize, usize)
Indicates that a reversed char-index range (end < start) was encountered.
Contains the [start, end) char indices of the range, in that order.
ByteRangeOutOfBounds(Option<usize>, Option<usize>, usize)
Indicates that the passed byte-index range was partially or fully out of bounds.
Contains the [start, end) byte indices of the range and the actual
length of the Rope
/RopeSlice
in bytes, in that order. When
either the start or end are None
, that indicates a half-open range.
CharRangeOutOfBounds(Option<usize>, Option<usize>, usize)
Indicates that the passed char-index range was partially or fully out of bounds.
Contains the [start, end) char indices of the range and the actual
length of the Rope
/RopeSlice
in chars, in that order. When
either the start or end are None
, that indicates a half-open range.
Trait Implementations
sourceimpl Error for Error
impl Error for Error
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl Copy for Error
Auto Trait Implementations
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more