Skip to content

Commit f2a9fc7

Browse files
committed
Fmt.
1 parent 6321eea commit f2a9fc7

File tree

9 files changed

+19
-34
lines changed

9 files changed

+19
-34
lines changed

crates/processing_pyo3/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ mod glfw;
1212
mod gltf;
1313
mod graphics;
1414
pub(crate) mod material;
15+
pub(crate) mod shader;
1516
#[cfg(feature = "webcam")]
1617
mod webcam;
17-
pub(crate) mod shader;
1818

1919
use graphics::{Geometry, Graphics, Image, Light, Topology, get_graphics, get_graphics_mut};
2020
use material::Material;

crates/processing_pyo3/src/webcam.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,15 @@ pub struct Webcam {
1616
impl Webcam {
1717
#[new]
1818
#[pyo3(signature = (width=None, height=None, framerate=None))]
19-
pub fn new(
20-
width: Option<u32>,
21-
height: Option<u32>,
22-
framerate: Option<u32>,
23-
) -> PyResult<Self> {
19+
pub fn new(width: Option<u32>, height: Option<u32>, framerate: Option<u32>) -> PyResult<Self> {
2420
let entity = match (width, height, framerate) {
2521
(Some(w), Some(h), Some(fps)) => webcam_create_with_format(WebcamFormat::Exact {
2622
resolution: bevy::math::UVec2::new(w, h),
2723
framerate: fps,
2824
}),
29-
(Some(w), Some(h), None) => webcam_create_with_format(WebcamFormat::Resolution(
30-
bevy::math::UVec2::new(w, h),
31-
)),
25+
(Some(w), Some(h), None) => {
26+
webcam_create_with_format(WebcamFormat::Resolution(bevy::math::UVec2::new(w, h)))
27+
}
3228
(None, None, Some(fps)) => webcam_create_with_format(WebcamFormat::FrameRate(fps)),
3329
_ => webcam_create(),
3430
}
@@ -38,18 +34,16 @@ impl Webcam {
3834
}
3935

4036
pub fn is_connected(&self) -> PyResult<bool> {
41-
webcam_is_connected(self.entity)
42-
.map_err(|e| PyRuntimeError::new_err(format!("{e}")))
37+
webcam_is_connected(self.entity).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
4338
}
4439

4540
pub fn resolution(&self) -> PyResult<(u32, u32)> {
46-
webcam_resolution(self.entity)
47-
.map_err(|e| PyRuntimeError::new_err(format!("{e}")))
41+
webcam_resolution(self.entity).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
4842
}
4943

5044
pub fn image(&self) -> PyResult<Image> {
51-
let entity = webcam_image(self.entity)
52-
.map_err(|e| PyRuntimeError::new_err(format!("{e}")))?;
45+
let entity =
46+
webcam_image(self.entity).map_err(|e| PyRuntimeError::new_err(format!("{e}")))?;
5347
Ok(Image::from_entity(entity))
5448
}
5549
}

crates/processing_render/src/geometry/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use bevy::{
1616
render::render_resource::PrimitiveTopology,
1717
};
1818

19-
use processing_core::error::{ProcessingError, Result};
2019
use crate::render::primitive::{box_mesh, sphere_mesh};
20+
use processing_core::error::{ProcessingError, Result};
2121

2222
pub struct GeometryPlugin;
2323

crates/processing_render/src/gltf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ use bevy::{
1313
scene::SceneSpawner,
1414
};
1515

16-
use processing_core::config::{Config, ConfigKey};
17-
use processing_core::error::{ProcessingError, Result};
1816
use crate::geometry::{BuiltinAttributes, Geometry, layout::VertexLayout};
1917
use crate::graphics;
2018
use crate::render::material::UntypedMaterial;
19+
use processing_core::config::{Config, ConfigKey};
20+
use processing_core::error::{ProcessingError, Result};
2121

2222
#[derive(Component)]
2323
pub struct GltfNodeTransform(pub Transform);

crates/processing_render/src/graphics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use bevy::{
2525
window::WindowRef,
2626
};
2727

28-
use processing_core::error::{ProcessingError, Result};
2928
use crate::{
3029
Flush,
3130
image::{Image, create_readback_buffer, pixel_size, pixels_to_bytes},
@@ -35,6 +34,7 @@ use crate::{
3534
},
3635
surface::Surface,
3736
};
37+
use processing_core::error::{ProcessingError, Result};
3838

3939
pub struct GraphicsPlugin;
4040

crates/processing_render/src/material/custom.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ use bevy_naga_reflect::dynamic_shader::DynamicShader;
4242

4343
use bevy::shader::Shader as ShaderAsset;
4444

45-
use processing_core::config::{Config, ConfigKey};
46-
use processing_core::error::{ProcessingError, Result};
4745
use crate::material::MaterialValue;
4846
use crate::render::material::UntypedMaterial;
47+
use processing_core::config::{Config, ConfigKey};
48+
use processing_core::error::{ProcessingError, Result};
4949

5050
#[derive(Asset, TypePath, Clone)]
5151
pub struct CustomMaterial {

crates/processing_render/src/material/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pub mod pbr;
33

44
use bevy::prelude::*;
55

6-
use processing_core::error::{ProcessingError, Result};
76
use crate::render::material::UntypedMaterial;
7+
use processing_core::error::{ProcessingError, Result};
88

99
pub struct MaterialPlugin;
1010

crates/processing_render/src/surface.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ use raw_window_handle::{
3434
use processing_core::error::{self, ProcessingError, Result};
3535
use std::ptr::NonNull;
3636

37-
use crate::{
38-
image::{Image, ImageTextures},
39-
};
37+
use crate::image::{Image, ImageTextures};
4038

4139
#[derive(Component, Debug, Clone)]
4240
pub struct Surface;

crates/processing_webcam/src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ use processing_render::image;
1515
pub struct ProcessingWebcam;
1616

1717
fn create(In(()): In<()>, mut commands: Commands) -> Entity {
18-
commands
19-
.spawn((ProcessingWebcam, Webcam::default()))
20-
.id()
18+
commands.spawn((ProcessingWebcam, Webcam::default())).id()
2119
}
2220

2321
fn create_with_format(In(format): In<WebcamFormat>, mut commands: Commands) -> Entity {
@@ -62,12 +60,7 @@ fn destroy(In(entity): In<Entity>, mut commands: Commands) -> Result<()> {
6260
}
6361

6462
pub fn webcam_create() -> Result<Entity> {
65-
app_mut(|app| {
66-
Ok(app
67-
.world_mut()
68-
.run_system_cached_with(create, ())
69-
.unwrap())
70-
})
63+
app_mut(|app| Ok(app.world_mut().run_system_cached_with(create, ()).unwrap()))
7164
}
7265

7366
pub fn webcam_create_with_format(format: WebcamFormat) -> Result<Entity> {

0 commit comments

Comments
 (0)