WIP

Antonio Scandurra created

Change summary

Cargo.lock                     | 11 ++++++++
crates/room/Cargo.toml         | 27 +++++++++++++++++++++
crates/room/src/participant.rs | 15 ++++++++++++
crates/room/src/room.rs        | 45 ++++++++++++++++++++++++++++++++++++
4 files changed, 98 insertions(+)

Detailed changes

Cargo.lock 🔗

@@ -4451,6 +4451,17 @@ dependencies = [
  "librocksdb-sys",
 ]
 
+[[package]]
+name = "room"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "client",
+ "gpui",
+ "project",
+ "workspace",
+]
+
 [[package]]
 name = "roxmltree"
 version = "0.14.1"

crates/room/Cargo.toml 🔗

@@ -0,0 +1,27 @@
+[package]
+name = "room"
+version = "0.1.0"
+edition = "2021"
+
+[lib]
+path = "src/room.rs"
+doctest = false
+
+[features]
+test-support = [
+    "client/test-support",
+    "gpui/test-support",
+    "project/test-support",
+]
+
+[dependencies]
+anyhow = "1.0.38"
+client = { path = "../client" }
+gpui = { path = "../gpui" }
+project = { path = "../project" }
+workspace = { path = "../workspace" }
+
+[dev-dependencies]
+client = { path = "../client", features = ["test-support"] }
+gpui = { path = "../gpui", features = ["test-support"] }
+project = { path = "../project", features = ["test-support"] }

crates/room/src/participant.rs 🔗

@@ -0,0 +1,15 @@
+use client::User;
+use gpui::{ModelHandle, ViewHandle};
+use project::Project;
+use workspace::Workspace;
+
+pub struct LocalParticipant {
+    user: User,
+    workspaces: Vec<ViewHandle<Workspace>>,
+}
+
+pub struct RemoteParticipant {
+    user: User,
+    workspaces: Vec<ViewHandle<Workspace>>,
+    active_workspace_id: usize,
+}

crates/room/src/room.rs 🔗

@@ -0,0 +1,45 @@
+mod participant;
+
+use anyhow::Result;
+use client::Client;
+use gpui::ModelHandle;
+use participant::{LocalParticipant, RemoteParticipant};
+use project::Project;
+use std::sync::Arc;
+
+pub struct Room {
+    id: u64,
+    local_participant: LocalParticipant,
+    remote_participants: Vec<RemoteParticipant>,
+    client: Arc<Client>,
+}
+
+impl Room {
+    pub async fn create(client: Arc<Client>) -> Result<u64> {
+        todo!()
+    }
+
+    pub async fn join(id: u64, client: Arc<Client>) -> Result<Self> {
+        todo!()
+    }
+
+    pub async fn invite(&mut self, user_id: u64) -> Result<()> {
+        todo!()
+    }
+
+    pub async fn share(&mut self) -> Result<()> {
+        todo!()
+    }
+
+    pub async fn unshare(&mut self) -> Result<()> {
+        todo!()
+    }
+
+    pub async fn mute(&mut self) -> Result<()> {
+        todo!()
+    }
+
+    pub async fn unmute(&mut self) -> Result<()> {
+        todo!()
+    }
+}