#[non_exhaustive]pub struct Range {
pub start: Position,
pub end: Position,
}Expand description
A [start, end) span over Positions, field-for-field identical to
tower_lsp_server::ls_types::Range but carrying no dependency on tower-lsp-server.
§Examples
use deps_core::position::{Position, Range};
let range = Range::new(Position::new(0, 0), Position::new(0, 4));
assert_eq!(range.start, Position::new(0, 0));
assert_eq!(range.end, Position::new(0, 4));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.start: PositionInclusive start position.
end: PositionExclusive end position.
Implementations§
Source§impl Range
impl Range
Sourcepub const fn new(start: Position, end: Position) -> Self
pub const fn new(start: Position, end: Position) -> Self
Builds a Range from its start/end 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, Range};
let range = Range::new(Position::new(1, 0), Position::new(1, 8));
assert_eq!(range.start.line, 1);Trait Implementations§
impl Copy for Range
impl Eq for Range
impl StructuralPartialEq for Range
Auto Trait Implementations§
impl Freeze for Range
impl RefUnwindSafe for Range
impl Send for Range
impl Sync for Range
impl Unpin for Range
impl UnsafeUnpin for Range
impl UnwindSafe for Range
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.