Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed most non-exhaustive from the crate #197

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions crates/yakui-core/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::input::{KeyCode, Modifiers, MouseButton};

/// An event that can be handled by yakui.
#[derive(Debug)]
#[non_exhaustive]
pub enum Event {
/// The viewport has changed. This can mean resizing as well as positioning.
ViewportChanged(Rect),
Expand Down Expand Up @@ -49,7 +48,6 @@ pub enum Event {

/// An event that can be handled by an individual widget.
#[derive(Debug)]
#[non_exhaustive]
pub enum WidgetEvent {
/// The mouse entered the widget's layout rectangle.
MouseEnter,
Expand All @@ -68,7 +66,6 @@ pub enum WidgetEvent {

/// A mouse button changed state while the cursor was inside the widget's
/// layout rectangle.
#[non_exhaustive]
MouseButtonChanged {
/// Which button was changed.
button: MouseButton,
Expand All @@ -87,7 +84,6 @@ pub enum WidgetEvent {
},

/// A keyboard key changed.
#[non_exhaustive]
KeyChanged {
/// Which key was changed.
key: KeyCode,
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-core/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pub struct LayoutDom {

/// A node in a [`LayoutDom`].
#[derive(Debug)]
#[non_exhaustive]
pub struct LayoutDomNode {
/// The bounding rectangle of the node in logical pixels.
pub rect: Rect,
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-core/src/paint/layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use super::PaintCall;

/// Contains all of the draw calls for a single layer of the UI.
#[derive(Debug)]
#[non_exhaustive]
pub struct PaintLayer {
/// The draw calls that can be used to paint this layer.
pub calls: Vec<PaintCall>,
Expand Down
4 changes: 0 additions & 4 deletions crates/yakui-core/src/paint/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use glam::{Vec2, Vec4};
use crate::geometry::Rect;
use crate::id::TextureId;

#[non_exhaustive]
#[allow(missing_docs)]
pub struct PaintMesh<V, I> {
pub vertices: V,
Expand All @@ -30,7 +29,6 @@ where
}

#[derive(Debug)]
#[non_exhaustive]
#[allow(missing_docs)]
pub struct PaintCall {
pub vertices: Vec<Vertex>,
Expand All @@ -54,7 +52,6 @@ impl PaintCall {
}

#[derive(Debug, Clone, Copy)]
#[non_exhaustive]
#[allow(missing_docs)]
pub struct Vertex {
pub position: Vec2,
Expand All @@ -80,7 +77,6 @@ impl Vertex {

/// The graphics pipeline that a draw call should be executed with.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Pipeline {
/// Pipline for drawing most geometry: vertices and an optional color
/// texture.
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-core/src/paint/rect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const RECT_INDEX: [u16; 6] = [
3, 0, 2,
];

#[non_exhaustive]
#[allow(missing_docs)]
pub struct PaintRect {
pub rect: Rect,
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-core/src/paint/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ impl std::fmt::Debug for Texture {

/// A texture format that yakui can manage.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum TextureFormat {
/// Red, green, blue, and alpha channels, each represented as a `u8`. The
/// color channels are sRGB-encoded.
Expand Down
6 changes: 0 additions & 6 deletions crates/yakui-core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::geometry::{Constraints, Dim2, Vec2};

/// Defines how an object participates in layout.
#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub enum Flow {
/// The widget participates in list, grid, and table layouts.
///
Expand All @@ -27,7 +26,6 @@ pub enum Flow {
/// For example, a horizontal list's main axis is horizontal, and a vertical
/// list's main axis is vertical.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum MainAxisSize {
/// Make the container fill all available space along its main axis.
Max,
Expand All @@ -41,7 +39,6 @@ pub enum MainAxisSize {
/// For example, a horizontal list's main axis is horizontal, and a vertical
/// list's main axis is vertical.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum MainAxisAlignment {
/// Align items to the beginning of the container's main axis.
///
Expand Down Expand Up @@ -77,7 +74,6 @@ pub enum MainAxisAlignment {
///
/// This occurs in a Grid when items of the same row are bigger than one self.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum MainAxisAlignItems {
/// Align item to the beginning of the cell main axis.
///
Expand Down Expand Up @@ -105,7 +101,6 @@ pub enum MainAxisAlignItems {
/// For example, a horizontal list's cross axis is vertical, and a vertical
/// list's cross axis is horizontal.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum CrossAxisAlignment {
/// Align items to the beginning of the container's cross axis.
///
Expand All @@ -130,7 +125,6 @@ pub enum CrossAxisAlignment {

/// Defines the direction that a container will lay out its children.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Direction {
/// Lay out children from top to bottom.
Down,
Expand Down
4 changes: 0 additions & 4 deletions crates/yakui-core/src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub trait Props: fmt::Debug {}
impl<T> Props for T where T: fmt::Debug {}

/// Information available to a widget during the layout phase.
#[non_exhaustive]
#[allow(missing_docs)]
pub struct LayoutContext<'dom> {
pub dom: &'dom Dom,
Expand All @@ -41,7 +40,6 @@ impl<'dom> LayoutContext<'dom> {
}

/// Information available to a widget during the paint phase.
#[non_exhaustive]
#[allow(missing_docs)]
pub struct PaintContext<'dom> {
pub dom: &'dom Dom,
Expand All @@ -57,7 +55,6 @@ impl<'dom> PaintContext<'dom> {
}

/// Information available to a widget when it has received an event.
#[non_exhaustive]
#[allow(missing_docs)]
pub struct EventContext<'dom> {
pub dom: &'dom Dom,
Expand All @@ -66,7 +63,6 @@ pub struct EventContext<'dom> {
}

/// Information available to a widget when it is being queried for navigation.
#[non_exhaustive]
#[allow(missing_docs)]
pub struct NavigateContext<'dom> {
pub dom: &'dom Dom,
Expand Down
2 changes: 0 additions & 2 deletions crates/yakui-vulkan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ pub struct YakuiVulkan {
}

/// Vulkan configuration
#[non_exhaustive]
#[derive(Default)]
pub struct Options {
/// Indicates that VK_KHR_dynamic_rendering is enabled and should be used with the given format
Expand Down Expand Up @@ -107,7 +106,6 @@ impl From<yakui_core::paint::Pipeline> for Workflow {
match p {
yakui_core::paint::Pipeline::Main => Workflow::Main,
yakui_core::paint::Pipeline::Text => Workflow::Text,
_ => panic!("Unknown pipeline {p:?}"),
}
}
}
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-vulkan/src/vulkan_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ fn get_format(yakui_format: yakui::paint::TextureFormat) -> vk::Format {
yakui::paint::TextureFormat::Rgba8Srgb => vk::Format::R8G8B8A8_SRGB,
yakui::paint::TextureFormat::Rgba8SrgbPremultiplied => vk::Format::R8G8B8A8_SRGB,
yakui::paint::TextureFormat::R8 => vk::Format::R8_UNORM,
_ => panic!("Unsupported texture format: {yakui_format:?}"),
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/yakui-wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ impl YakuiWgpu {
match command.pipeline {
Pipeline::Main => render_pass.set_pipeline(main_pipeline),
Pipeline::Text => render_pass.set_pipeline(text_pipeline),
_ => continue,
}

if command.clip != last_clip {
Expand Down
3 changes: 0 additions & 3 deletions crates/yakui-wgpu/src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ fn data_layout(format: TextureFormat, size: UVec2) -> wgpu::ImageDataLayout {
bytes_per_row: Some(size.x),
rows_per_image: Some(size.y),
},
_ => panic!("Unsupported texture format {format:?}"),
}
}

Expand All @@ -128,7 +127,6 @@ fn wgpu_format(format: TextureFormat) -> wgpu::TextureFormat {
TextureFormat::Rgba8Srgb => wgpu::TextureFormat::Rgba8UnormSrgb,
TextureFormat::Rgba8SrgbPremultiplied => wgpu::TextureFormat::Rgba8UnormSrgb,
TextureFormat::R8 => wgpu::TextureFormat::R8Unorm,
_ => panic!("Unsupported texture format {format:?}"),
}
}

Expand Down Expand Up @@ -165,6 +163,5 @@ fn premultiply_alpha(texture: &Texture) -> Cow<'_, Texture> {
}
TextureFormat::Rgba8SrgbPremultiplied => Cow::Borrowed(texture),
TextureFormat::R8 => Cow::Borrowed(texture),
_ => Cow::Borrowed(texture),
}
}
2 changes: 0 additions & 2 deletions crates/yakui-widgets/src/shapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ pub fn outline(output: &mut PaintDom, rect: Rect, w: f32, color: Color) {
output.add_mesh(mesh);
}

#[non_exhaustive]
pub struct Circle {
pub center: Vec2,
pub radius: f32,
Expand Down Expand Up @@ -163,7 +162,6 @@ const RECT_INDEX: [u16; 6] = [
3, 0, 2,
];

#[non_exhaustive]
pub struct RoundedRectangle {
pub rect: Rect,
pub radius: f32,
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-widgets/src/style.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use yakui_core::geometry::Color;

#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct TextStyle {
pub font_size: f32,
pub line_height_override: Option<f32>,
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-widgets/src/widgets/align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Align::new(yakui::Alignment::TOP_RIGHT).show(|| {
```
*/
#[derive(Debug, Clone)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct Align {
pub alignment: Alignment,
Expand Down
2 changes: 0 additions & 2 deletions crates/yakui-widgets/src/widgets/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ if yakui::button("Hello").clicked {
```
*/
#[derive(Debug)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct Button {
pub text: Cow<'static, str>,
Expand All @@ -41,7 +40,6 @@ pub struct Button {

/// Contains styles that can vary based on the state of the button.
#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct DynamicButtonStyle {
pub text: TextStyle,
pub fill: Color,
Expand Down
2 changes: 0 additions & 2 deletions crates/yakui-widgets/src/widgets/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ value = yakui::checkbox(value).checked;
```
*/
#[derive(Debug)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct Checkbox {
pub checked: bool,
Expand All @@ -49,7 +48,6 @@ pub struct CheckboxWidget {
}

#[derive(Debug)]
#[non_exhaustive]
pub struct CheckboxResponse {
pub checked: bool,
}
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-widgets/src/widgets/circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ A colored circle that can contain children.
Responds with [CircleResponse].
*/
#[derive(Debug, Clone)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct Circle {
pub color: Color,
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-widgets/src/widgets/colored_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ A colored box that can contain children.
Responds with [ColoredBoxResponse].
*/
#[derive(Debug, Clone)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct ColoredBox {
pub color: Color,
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-widgets/src/widgets/constrained_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ A box that forces specific constraints onto its child.
Responds with [ConstrainedBoxResponse].
*/
#[derive(Debug, Clone)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct ConstrainedBox {
pub constraints: Constraints,
Expand Down
6 changes: 0 additions & 6 deletions crates/yakui-widgets/src/widgets/count_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Check the count_grid example to see it in action with different alignments and s
Responds with [CountGridResponse].
*/
#[derive(Debug, Clone)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct CountGrid {
pub direction: Direction,
Expand Down Expand Up @@ -224,7 +223,6 @@ impl Widget for CountGridWidget {
offset_main_global = match self.props.main_axis_size {
MainAxisSize::Max => offset_main_global,
MainAxisSize::Min => 0.0,
other => unimplemented!("MainAxisSize::{other:?}"),
};

// only used in case the widget total cross is less than the minimum cross axis
Expand All @@ -236,7 +234,6 @@ impl Widget for CountGridWidget {
CrossAxisAlignment::End => {
(direction.get_cross_axis(input.min) - max_total_cross_size).max(0.0)
}
other => unimplemented!("CrossAxisAlignment::{other:?}"),
};

// Apply alignment by offsetting all children
Expand All @@ -255,7 +252,6 @@ impl Widget for CountGridWidget {
CrossAxisAlignment::Start | CrossAxisAlignment::Stretch => 0.0,
CrossAxisAlignment::Center => ((cell_cross_size - child_cross_size) / 2.0).max(0.0),
CrossAxisAlignment::End => (cell_cross_size - child_cross_size).max(0.0),
other => unimplemented!("CrossAxisAlignment::{other:?}"),
};

let child_main_size = direction.get_main_axis(layout.rect.size());
Expand All @@ -267,7 +263,6 @@ impl Widget for CountGridWidget {
MainAxisAlignItems::Start | MainAxisAlignItems::Stretch => 0.0,
MainAxisAlignItems::Center => ((cell_main_size - child_main_size) / 2.0).max(0.0),
MainAxisAlignItems::End => (cell_main_size - child_main_size).max(0.0),
other => unimplemented!("MainAxisAlignItems::{other:?}"),
};

let offset_pos = layout.rect.pos()
Expand All @@ -290,7 +285,6 @@ impl Widget for CountGridWidget {
let main_grid_size = match self.props.main_axis_size {
MainAxisSize::Max => total_main_max,
MainAxisSize::Min => total_main_size,
other => unimplemented!("MainAxisSize::{other:?}"),
};

direction.vec2(main_grid_size, cross_grid_size)
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-widgets/src/widgets/cutout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ implementing a blur-behind effect.
Responds with [CutOutResponse].
*/
#[derive(Debug, Clone)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct CutOut {
pub image: Option<TextureId>,
Expand Down
1 change: 0 additions & 1 deletion crates/yakui-widgets/src/widgets/divider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use yakui_core::Response;
///
/// Responds with [DividerResponse].
#[derive(Debug)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct Divider {
/// The color of the divider.
Expand Down
2 changes: 0 additions & 2 deletions crates/yakui-widgets/src/widgets/draggable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use yakui_core::Response;
use crate::util::widget_children;

#[derive(Debug)]
#[non_exhaustive]
#[must_use = "yakui widgets do nothing if you don't `show` them"]
pub struct Draggable {}

Expand All @@ -34,7 +33,6 @@ struct DragState {
}

#[derive(Debug)]
#[non_exhaustive]
pub struct DraggableResponse {
pub dragging: Option<Dragging>,
}
Expand Down
Loading
Loading