generics + DashInterface impl (#334)

This commit is contained in:
galister
2025-12-28 18:44:58 +00:00
committed by GitHub
parent ee39e22472
commit 9425db9ae4
17 changed files with 348 additions and 156 deletions

View File

@@ -3,15 +3,15 @@ use wayvr_ipc::{
packet_server::{WvrProcess, WvrProcessHandle, WvrWindow, WvrWindowHandle},
};
pub trait DashInterface {
fn window_list(&mut self) -> anyhow::Result<Vec<WvrWindow>>;
fn window_set_visible(&mut self, handle: WvrWindowHandle, visible: bool) -> anyhow::Result<()>;
fn window_request_close(&mut self, handle: WvrWindowHandle) -> anyhow::Result<()>;
fn process_get(&mut self, handle: WvrProcessHandle) -> Option<WvrProcess>;
fn process_launch(&mut self, params: WvrProcessLaunchParams) -> anyhow::Result<WvrProcessHandle>;
fn process_list(&mut self) -> anyhow::Result<Vec<WvrProcess>>;
fn process_terminate(&mut self, handle: WvrProcessHandle) -> anyhow::Result<()>;
fn recenter_playspace(&mut self) -> anyhow::Result<()>;
pub trait DashInterface<T> {
fn window_list(&mut self, data: &mut T) -> anyhow::Result<Vec<WvrWindow>>;
fn window_set_visible(&mut self, data: &mut T, handle: WvrWindowHandle, visible: bool) -> anyhow::Result<()>;
fn window_request_close(&mut self, data: &mut T, handle: WvrWindowHandle) -> anyhow::Result<()>;
fn process_get(&mut self, data: &mut T, handle: WvrProcessHandle) -> Option<WvrProcess>;
fn process_launch(&mut self, data: &mut T, params: WvrProcessLaunchParams) -> anyhow::Result<WvrProcessHandle>;
fn process_list(&mut self, data: &mut T) -> anyhow::Result<Vec<WvrProcess>>;
fn process_terminate(&mut self, data: &mut T, handle: WvrProcessHandle) -> anyhow::Result<()>;
fn recenter_playspace(&mut self, data: &mut T) -> anyhow::Result<()>;
}
pub type BoxDashInterface = Box<dyn DashInterface>;
pub type BoxDashInterface<T> = Box<dyn DashInterface<T>>;