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,6 +1,7 @@
use crate::common::{
wayland,
x11::{self, Frame},
TraitCapturer,
};
use std::{io, time::Duration};
@@ -17,13 +18,6 @@ impl Capturer {
})
}
pub fn set_use_yuv(&mut self, use_yuv: bool) {
match self {
Capturer::X11(d) => d.set_use_yuv(use_yuv),
Capturer::WAYLAND(d) => d.set_use_yuv(use_yuv),
}
}
pub fn width(&self) -> usize {
match self {
Capturer::X11(d) => d.width(),
@@ -37,8 +31,17 @@ impl Capturer {
Capturer::WAYLAND(d) => d.height(),
}
}
}
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) {
match self {
Capturer::X11(d) => d.set_use_yuv(use_yuv),
Capturer::WAYLAND(d) => d.set_use_yuv(use_yuv),
}
}
fn frame<'a>(&'a mut self, timeout: Duration) -> io::Result<Frame<'a>> {
match self {
Capturer::X11(d) => d.frame(timeout),
Capturer::WAYLAND(d) => d.frame(timeout),