mirror of
https://github.com/hexedtech/codemp-proto.git
synced 2024-12-23 05:44:52 +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 {
|
||||
tonic::include_proto!("buffer");
|
||||
}
|
||||
|
||||
pub mod 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 {
|
||||
tonic::include_proto!("workspace");
|
||||
}
|
||||
|
||||
pub mod auth {
|
||||
tonic::include_proto!("auth");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue