#[non_exhaustive]pub struct Position {
pub line: u32,
pub character: u32,
}Expand description
A zero-indexed line/UTF-16-code-unit-offset position, field-for-field identical to
tower_lsp_server::ls_types::Position but carrying no dependency on tower-lsp-server.
§Examples
use deps_core::position::Position;
let pos = Position::new(3, 7);
assert_eq!(pos.line, 3);
assert_eq!(pos.character, 7);
assert_eq!(pos, Position::new(3, 7));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.line: u32Zero-indexed line number.
character: u32Zero-indexed UTF-16 code unit offset on Self::line.
Implementations§
Source§impl Position
impl Position
Sourcepub const fn new(line: u32, character: u32) -> Self
pub const fn new(line: u32, character: u32) -> Self
Builds a Position from its line/character fields.
Needed because Self is #[non_exhaustive]: a struct literal only works inside
this crate, so every other crate (e.g. the 14 ecosystem crates constructing a
crate::ecosystem::Dependency impl) must call this constructor instead.
§Examples
use deps_core::position::Position;
let pos = Position::new(0, 4);
assert_eq!(pos.line, 0);Trait Implementations§
impl Copy for Position
impl Eq for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnsafeUnpin for Position
impl UnwindSafe for Position
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§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.