pub enum PositionError {
OffsetOutOfBounds {
offset: ByteOffset,
len: ByteOffset,
},
LineOutOfBounds {
line: u32,
line_count: usize,
},
ByteColumnOutOfBounds {
line: u32,
column: u32,
max_column: u32,
},
CharacterOutOfBounds {
line: u32,
character: u32,
max_character: u32,
encoding: PositionEncoding,
},
OffsetInsideLineTerminator {
offset: ByteOffset,
line: u32,
},
MidCodePoint {
offset: ByteOffset,
},
MidUtf16Surrogate {
line: u32,
character: u32,
},
InvalidUtf8 {
valid_up_to: ByteOffset,
error_len: Option<usize>,
},
}Expand description
Failure to convert between byte offsets, byte positions, and editor positions.
Variants§
OffsetOutOfBounds
A byte offset lies beyond EOF.
LineOutOfBounds
A zero-based line does not exist.
ByteColumnOutOfBounds
A byte column does not identify a byte or the final EOF position.
CharacterOutOfBounds
An editor character lies beyond the logical end of its line.
OffsetInsideLineTerminator
A byte offset falls between the CR and LF bytes of a CRLF terminator.
MidCodePoint
A UTF-8 position falls within a multi-byte code point.
Fields
§
offset: ByteOffsetMidUtf16Surrogate
A UTF-16 position falls between the surrogate code units of an astral character.
InvalidUtf8
Editor conversion requires a valid UTF-8 source document.
Trait Implementations§
Source§impl Clone for PositionError
impl Clone for PositionError
Source§fn clone(&self) -> PositionError
fn clone(&self) -> PositionError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PositionError
Source§impl Debug for PositionError
impl Debug for PositionError
Source§impl Display for PositionError
impl Display for PositionError
impl Eq for PositionError
Source§impl Error for PositionError
impl Error for PositionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<PositionError> for DiagnosticReportError
impl From<PositionError> for DiagnosticReportError
Source§fn from(source: PositionError) -> Self
fn from(source: PositionError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for PositionError
impl PartialEq for PositionError
impl StructuralPartialEq for PositionError
Auto Trait Implementations§
impl Freeze for PositionError
impl RefUnwindSafe for PositionError
impl Send for PositionError
impl Sync for PositionError
impl Unpin for PositionError
impl UnsafeUnpin for PositionError
impl UnwindSafe for PositionError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.