mirror of
https://github.com/hexedtech/codemp-proto.git
synced 2024-11-22 07:24:50 +01:00
chore: moved rowcol trait impl into proto
This commit is contained in:
parent
460ef34712
commit
fa42d37e2f
1 changed files with 25 additions and 0 deletions
25
src/lib.rs
25
src/lib.rs
|
@ -36,12 +36,37 @@ pub mod files {
|
||||||
pub mod buffer {
|
pub mod buffer {
|
||||||
tonic::include_proto!("buffer");
|
tonic::include_proto!("buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod cursor {
|
pub mod cursor {
|
||||||
tonic::include_proto!("cursor");
|
tonic::include_proto!("cursor");
|
||||||
|
|
||||||
|
impl From<RowCol> for (i32, i32) {
|
||||||
|
fn from(pos: RowCol) -> (i32, i32) {
|
||||||
|
(pos.row, pos.col)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<(i32, i32)> for RowCol {
|
||||||
|
fn from((row, col): (i32, i32)) -> Self {
|
||||||
|
RowCol { row, col }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialOrd for RowCol {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
|
match self.row.partial_cmp(&other.row) {
|
||||||
|
Some(core::cmp::Ordering::Equal) => {}
|
||||||
|
ord => return ord,
|
||||||
|
}
|
||||||
|
self.col.partial_cmp(&other.col)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod workspace {
|
pub mod workspace {
|
||||||
tonic::include_proto!("workspace");
|
tonic::include_proto!("workspace");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod auth {
|
pub mod auth {
|
||||||
tonic::include_proto!("auth");
|
tonic::include_proto!("auth");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue