From 1c62222f2fe5b9a1c4edeb92b53d65a82e2e46d3 Mon Sep 17 00:00:00 2001 From: drendog Date: Wed, 21 Aug 2024 01:52:54 +0200 Subject: [PATCH] chore: more coherent builder methods naming with other one --- src/windowing/mod.rs | 16 ++++++++-------- src/windowing/state/builder.rs | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/windowing/mod.rs b/src/windowing/mod.rs index b0b9bce..c95d052 100644 --- a/src/windowing/mod.rs +++ b/src/windowing/mod.rs @@ -61,14 +61,14 @@ impl WindowingSystem { .context("Component definition is required")?; let state = WindowStateBuilder::new() - .component_definition(component_definition) - .surface(Rc::clone(&surface)) - .layer_surface(Rc::clone(&layer_surface)) - .pointer(Rc::clone(&pointer)) - .scale_factor(config.scale_factor) - .height(config.height) - .exclusive_zone(config.exclusive_zone) - .window(window) + .with_component_definition(component_definition) + .with_surface(Rc::clone(&surface)) + .with_layer_surface(Rc::clone(&layer_surface)) + .with_pointer(Rc::clone(&pointer)) + .with_scale_factor(config.scale_factor) + .with_height(config.height) + .with_exclusive_zone(config.exclusive_zone) + .with_window(window) .build()?; let event_loop = EventLoop::try_new().context("Failed to create event loop")?; diff --git a/src/windowing/state/builder.rs b/src/windowing/state/builder.rs index 70bd6b9..66f6727 100644 --- a/src/windowing/state/builder.rs +++ b/src/windowing/state/builder.rs @@ -26,52 +26,52 @@ impl WindowStateBuilder { Self::default() } - pub fn surface(mut self, surface: Rc) -> Self { + pub fn with_surface(mut self, surface: Rc) -> Self { self.surface = Some(surface); self } - pub fn layer_surface(mut self, layer_surface: Rc) -> Self { + pub fn with_layer_surface(mut self, layer_surface: Rc) -> Self { self.layer_surface = Some(layer_surface); self } - pub const fn size(mut self, size: PhysicalSize) -> Self { + pub const fn with_size(mut self, size: PhysicalSize) -> Self { self.size = Some(size); self } - pub const fn output_size(mut self, output_size: PhysicalSize) -> Self { + pub const fn with_output_size(mut self, output_size: PhysicalSize) -> Self { self.output_size = Some(output_size); self } - pub fn pointer(mut self, pointer: Rc) -> Self { + pub fn with_pointer(mut self, pointer: Rc) -> Self { self.pointer = Some(pointer); self } - pub fn window(mut self, window: Rc) -> Self { + pub fn with_window(mut self, window: Rc) -> Self { self.window = Some(window); self } - pub const fn scale_factor(mut self, scale_factor: f32) -> Self { + pub const fn with_scale_factor(mut self, scale_factor: f32) -> Self { self.scale_factor = scale_factor; self } - pub const fn height(mut self, height: u32) -> Self { + pub const fn with_height(mut self, height: u32) -> Self { self.height = height; self } - pub const fn exclusive_zone(mut self, exclusive_zone: i32) -> Self { + pub const fn with_exclusive_zone(mut self, exclusive_zone: i32) -> Self { self.exclusive_zone = exclusive_zone; self } - pub fn component_definition(mut self, component_definition: ComponentDefinition) -> Self { + pub fn with_component_definition(mut self, component_definition: ComponentDefinition) -> Self { self.component_definition = Some(component_definition); self }