remove old unused files for now
This commit is contained in:
parent
8dba8e7ce8
commit
8a6bd41baa
15 changed files with 35 additions and 1804 deletions
43
src/line.rs
43
src/line.rs
|
|
@ -1,43 +0,0 @@
|
|||
use std::num::NonZeroU64;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::prelude::*;
|
||||
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Line(pub u64);
|
||||
|
||||
/// Constructors.
|
||||
impl Line {
|
||||
pub const fn from_index(index: u64) -> Self {
|
||||
Self(index)
|
||||
}
|
||||
|
||||
pub const fn from_linenr(linenr: NonZeroU64) -> Self {
|
||||
Self(linenr.get() - 1)
|
||||
}
|
||||
|
||||
pub const fn next(self) -> Self {
|
||||
Self::from_index(self.index() + 1)
|
||||
}
|
||||
|
||||
/// Panics if self is line index 0.
|
||||
pub const fn prev(self) -> Self {
|
||||
Self::from_index(self.index() - 1)
|
||||
}
|
||||
}
|
||||
|
||||
/// Getters.
|
||||
impl Line {
|
||||
/// 0-indexed
|
||||
pub const fn index(self) -> u64 {
|
||||
self.0
|
||||
}
|
||||
|
||||
/// 1-indexed
|
||||
pub const fn linenr(self) -> u64 {
|
||||
self.0 + 1
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Lines(Vec<Line>);
|
||||
Loading…
Add table
Add a link
Reference in a new issue