1
0
Fork 0
forked from wry/wry
wry/src/it/test_ifs/test_syncobj_timeline.rs
2024-04-03 17:14:58 +02:00

34 lines
814 B
Rust

use {
crate::{
it::{test_error::TestError, test_object::TestObject, test_transport::TestTransport},
wire::{wp_linux_drm_syncobj_timeline_v1::*, WpLinuxDrmSyncobjTimelineV1Id},
},
std::{cell::Cell, rc::Rc},
};
pub struct TestSyncobjTimeline {
pub id: WpLinuxDrmSyncobjTimelineV1Id,
pub tran: Rc<TestTransport>,
pub destroyed: Cell<bool>,
}
impl TestSyncobjTimeline {
pub fn destroy(&self) -> Result<(), TestError> {
if !self.destroyed.replace(true) {
self.tran.send(Destroy { self_id: self.id })?;
}
Ok(())
}
}
impl Drop for TestSyncobjTimeline {
fn drop(&mut self) {
let _ = self.destroy();
}
}
test_object! {
TestSyncobjTimeline, WpLinuxDrmSyncobjTimelineV1;
}
impl TestObject for TestSyncobjTimeline {}