Skip to content

Commit

Permalink
cargo fmt --all
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher N. Hesse <[email protected]>
  • Loading branch information
raymanfx committed Apr 14, 2024
1 parent 8eedc06 commit de41bab
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
1 change: 0 additions & 1 deletion eye-hal/src/platform/v4l2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub mod context;
pub mod device;
pub mod stream;


use std::{convert::TryInto, str};

use crate::format::PixelFormat;
Expand Down
10 changes: 5 additions & 5 deletions eye/src/colorconvert/codec/jpeg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ pub fn blueprint() -> impl Blueprint {
Builder::default()
}

#[derive(Debug, Clone)]
#[derive(Default)]
#[derive(Debug, Clone, Default)]
pub struct Builder {}


impl Blueprint for Builder {
fn instantiate(
&self,
Expand All @@ -21,10 +19,12 @@ impl Blueprint for Builder {
) -> Result<Box<dyn Codec + Send>> {
if !self
.src_fmts()
.iter().any(|pixfmt| *pixfmt == inparams.pixfmt)
.iter()
.any(|pixfmt| *pixfmt == inparams.pixfmt)
|| !self
.dst_fmts()
.iter().any(|pixfmt| *pixfmt == outparams.pixfmt)
.iter()
.any(|pixfmt| *pixfmt == outparams.pixfmt)
{
return Err(Error::from(ErrorKind::UnsupportedFormat));
}
Expand Down
10 changes: 5 additions & 5 deletions eye/src/colorconvert/codec/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ pub fn blueprint() -> impl Blueprint {
Builder::default()
}

#[derive(Debug, Clone)]
#[derive(Default)]
#[derive(Debug, Clone, Default)]
pub struct Builder {}


impl Blueprint for Builder {
fn instantiate(
&self,
Expand All @@ -24,10 +22,12 @@ impl Blueprint for Builder {
) -> Result<Box<dyn Codec + Send>> {
if !self
.src_fmts()
.iter().any(|pixfmt| *pixfmt == inparams.pixfmt)
.iter()
.any(|pixfmt| *pixfmt == inparams.pixfmt)
|| !self
.dst_fmts()
.iter().any(|pixfmt| *pixfmt == outparams.pixfmt)
.iter()
.any(|pixfmt| *pixfmt == outparams.pixfmt)
{
return Err(Error::from(ErrorKind::UnsupportedFormat));
}
Expand Down
22 changes: 7 additions & 15 deletions eye/src/colorconvert/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,8 @@ impl<'a> DeviceTrait<'a> for Device<'a> {
// now check which formats we can emulate
for blueprint in codec::blueprints() {
for chain in blueprint.src_fmts().iter().zip(blueprint.dst_fmts().iter()) {
if streams
.iter()
.any(|stream| stream.pixfmt == *chain.0)
&& !streams
.iter().any(|stream| stream.pixfmt == *chain.1)
if streams.iter().any(|stream| stream.pixfmt == *chain.0)
&& !streams.iter().any(|stream| stream.pixfmt == *chain.1)
{
// collect all streams with this pixfmt
let _streams: Vec<stream::Descriptor> = streams
Expand Down Expand Up @@ -86,11 +83,7 @@ impl<'a> DeviceTrait<'a> for Device<'a> {
// find a supported format mapping
let blueprints: Vec<Box<dyn codec::Blueprint>> = codec::blueprints()
.into_iter()
.filter(|bp| {
bp.dst_fmts()
.iter()
.any(|pixfmt| *pixfmt == desc.pixfmt)
})
.filter(|bp| bp.dst_fmts().iter().any(|pixfmt| *pixfmt == desc.pixfmt))
.collect();
let src_fmt = if let Some(pixfmt) = blueprints.iter().find_map(|bp| {
for pixfmt in bp.src_fmts() {
Expand All @@ -111,11 +104,10 @@ impl<'a> DeviceTrait<'a> for Device<'a> {
};

// get the codec blueprint
let blueprint = if let Some(bp) = blueprints.into_iter().find(|bp| {
bp.src_fmts()
.into_iter()
.any(|pixfmt| pixfmt == src_fmt)
}) {
let blueprint = if let Some(bp) = blueprints
.into_iter()
.find(|bp| bp.src_fmts().into_iter().any(|pixfmt| pixfmt == src_fmt))
{
bp
} else {
return Err(Error::new(
Expand Down

0 comments on commit de41bab

Please sign in to comment.