input: Introduce ProducerHandle type

This commit is contained in:
bjorn3
2024-12-24 15:28:34 +01:00
parent e3eb5fbb5d
commit aa35e573cf
10 changed files with 57 additions and 46 deletions
+13
View File
@@ -162,3 +162,16 @@ impl Damage {
self
}
}
pub struct ProducerHandle(File);
impl ProducerHandle {
pub fn new() -> Result<Self, Error> {
File::open("/scheme/input/producer").map(ProducerHandle)
}
pub fn write_event(&mut self, event: orbclient::Event) -> Result<(), Error> {
self.0.write(&event)?;
Ok(())
}
}