chore: moved rowcol trait impl into proto

This commit is contained in:
zaaarf 2024-03-09 19:49:11 +01:00
parent 460ef34712
commit fa42d37e2f
No known key found for this signature in database
GPG key ID: 102E445F4C3F829B

View file

@ -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");
} }