chore: add missing must use on state builder

WIP/draft
drendog 2024-08-21 13:50:49 +02:00
parent fc2e3944b4
commit c16768b224
Signed by: dwenya
GPG Key ID: 8DD77074645332D0
1 changed files with 11 additions and 0 deletions

View File

@ -21,55 +21,66 @@ pub struct WindowStateBuilder {
} }
impl WindowStateBuilder { impl WindowStateBuilder {
#[must_use]
pub fn new() -> Self { pub fn new() -> Self {
Self::default() Self::default()
} }
#[must_use]
pub fn with_surface(mut self, surface: Rc<WlSurface>) -> Self { pub fn with_surface(mut self, surface: Rc<WlSurface>) -> Self {
self.surface = Some(surface); self.surface = Some(surface);
self self
} }
#[must_use]
pub fn with_layer_surface(mut self, layer_surface: Rc<ZwlrLayerSurfaceV1>) -> Self { pub fn with_layer_surface(mut self, layer_surface: Rc<ZwlrLayerSurfaceV1>) -> Self {
self.layer_surface = Some(layer_surface); self.layer_surface = Some(layer_surface);
self self
} }
#[must_use]
pub const fn with_size(mut self, size: PhysicalSize) -> Self { pub const fn with_size(mut self, size: PhysicalSize) -> Self {
self.size = Some(size); self.size = Some(size);
self self
} }
#[must_use]
pub const fn with_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.output_size = Some(output_size);
self self
} }
#[must_use]
pub fn with_pointer(mut self, pointer: Rc<WlPointer>) -> Self { pub fn with_pointer(mut self, pointer: Rc<WlPointer>) -> Self {
self.pointer = Some(pointer); self.pointer = Some(pointer);
self self
} }
#[must_use]
pub fn with_window(mut self, window: Rc<FemtoVGWindow>) -> Self { pub fn with_window(mut self, window: Rc<FemtoVGWindow>) -> Self {
self.window = Some(window); self.window = Some(window);
self self
} }
#[must_use]
pub const fn with_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.scale_factor = scale_factor;
self self
} }
#[must_use]
pub const fn with_height(mut self, height: u32) -> Self { pub const fn with_height(mut self, height: u32) -> Self {
self.height = height; self.height = height;
self self
} }
#[must_use]
pub const fn with_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.exclusive_zone = exclusive_zone;
self self
} }
#[must_use]
pub fn with_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.component_definition = Some(component_definition);
self self