fix_capturer_trait_name_shadowing: build win

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-07-21 20:04:39 +08:00
parent 416832a1ed
commit d19a8fdc43
13 changed files with 122 additions and 117 deletions

View File

@@ -1,4 +1,4 @@
use crate::x11;
use crate::{x11, common::TraitCapturer};
use std::{io, ops, time::Duration};
pub struct Capturer(x11::Capturer);
@@ -8,10 +8,6 @@ impl Capturer {
x11::Capturer::new(display.0, yuv).map(Capturer)
}
pub fn set_use_yuv(&mut self, use_yuv: bool) {
self.0.set_use_yuv(use_yuv);
}
pub fn width(&self) -> usize {
self.0.display().rect().w as usize
}
@@ -19,8 +15,14 @@ impl Capturer {
pub fn height(&self) -> usize {
self.0.display().rect().h as usize
}
}
pub fn frame<'a>(&'a mut self, _timeout: Duration) -> io::Result<Frame<'a>> {
impl TraitCapturer for Capturer {
fn set_use_yuv(&mut self, use_yuv: bool) {
self.0.set_use_yuv(use_yuv);
}
fn frame<'a>(&'a mut self, _timeout: Duration) -> io::Result<Frame<'a>> {
Ok(Frame(self.0.frame()?))
}
}