mirror of
https://github.com/hexedtech/codemp.git
synced 2025-04-03 10:01:41 +02:00
20 lines
674 B
Rust
20 lines
674 B
Rust
use codemp_proto::workspace::workspace_event::Event as WorkspaceEventInner;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum Event {
|
|
FileTreeUpdated(String),
|
|
UserJoin(String),
|
|
UserLeave(String),
|
|
}
|
|
|
|
impl From<&WorkspaceEventInner> for Event {
|
|
fn from(event: &WorkspaceEventInner) -> Self {
|
|
match event {
|
|
WorkspaceEventInner::Join(e) => Self::UserJoin(e.user.id.clone()),
|
|
WorkspaceEventInner::Leave(e) => Self::UserLeave(e.user.id.clone()),
|
|
WorkspaceEventInner::Create(e) => Self::FileTreeUpdated(e.path.clone()),
|
|
WorkspaceEventInner::Delete(e) => Self::FileTreeUpdated(e.path.clone()),
|
|
WorkspaceEventInner::Rename(e) => Self::FileTreeUpdated(e.after.clone()),
|
|
}
|
|
}
|
|
}
|