mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Remove thiserror
from bevy_ui
(#15760)
# Objective - Contributes to #15460 ## Solution - Removed `thiserror` from `bevy_ui`
This commit is contained in:
parent
bdc649a2d1
commit
c9e41ef552
5 changed files with 23 additions and 28 deletions
|
@ -36,7 +36,11 @@ bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
||||||
taffy = { version = "0.5" }
|
taffy = { version = "0.5" }
|
||||||
serde = { version = "1", features = ["derive"], optional = true }
|
serde = { version = "1", features = ["derive"], optional = true }
|
||||||
bytemuck = { version = "1.5", features = ["derive"] }
|
bytemuck = { version = "1.5", features = ["derive"] }
|
||||||
thiserror = "1.0.0"
|
derive_more = { version = "1", default-features = false, features = [
|
||||||
|
"error",
|
||||||
|
"from",
|
||||||
|
"display",
|
||||||
|
] }
|
||||||
nonmax = "0.5"
|
nonmax = "0.5"
|
||||||
smallvec = "1.11"
|
smallvec = "1.11"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use bevy_math::Vec2;
|
use bevy_math::Vec2;
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
use core::ops::{Div, DivAssign, Mul, MulAssign, Neg};
|
use core::ops::{Div, DivAssign, Mul, MulAssign, Neg};
|
||||||
use thiserror::Error;
|
use derive_more::derive::{Display, Error};
|
||||||
|
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||||
|
@ -175,11 +175,11 @@ impl Neg for Val {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, Clone, Copy, Error)]
|
#[derive(Debug, Eq, PartialEq, Clone, Copy, Error, Display)]
|
||||||
pub enum ValArithmeticError {
|
pub enum ValArithmeticError {
|
||||||
#[error("the variants of the Vals don't match")]
|
#[display("the variants of the Vals don't match")]
|
||||||
NonIdenticalVariants,
|
NonIdenticalVariants,
|
||||||
#[error("the given variant of Val is not evaluateable (non-numeric)")]
|
#[display("the given variant of Val is not evaluateable (non-numeric)")]
|
||||||
NonEvaluateable,
|
NonEvaluateable,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ use bevy_sprite::BorderRect;
|
||||||
use bevy_transform::components::Transform;
|
use bevy_transform::components::Transform;
|
||||||
use bevy_utils::tracing::warn;
|
use bevy_utils::tracing::warn;
|
||||||
use bevy_window::{PrimaryWindow, Window, WindowScaleFactorChanged};
|
use bevy_window::{PrimaryWindow, Window, WindowScaleFactorChanged};
|
||||||
use thiserror::Error;
|
use derive_more::derive::{Display, Error, From};
|
||||||
use ui_surface::UiSurface;
|
use ui_surface::UiSurface;
|
||||||
|
|
||||||
#[cfg(feature = "bevy_text")]
|
#[cfg(feature = "bevy_text")]
|
||||||
|
@ -61,12 +61,12 @@ impl Default for LayoutContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error, Display, From)]
|
||||||
pub enum LayoutError {
|
pub enum LayoutError {
|
||||||
#[error("Invalid hierarchy")]
|
#[display("Invalid hierarchy")]
|
||||||
InvalidHierarchy,
|
InvalidHierarchy,
|
||||||
#[error("Taffy error: {0}")]
|
#[display("Taffy error: {_0}")]
|
||||||
TaffyError(#[from] taffy::TaffyError),
|
TaffyError(taffy::TaffyError),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
|
|
@ -8,6 +8,7 @@ use bevy_render::{
|
||||||
extract_component::ExtractComponent,
|
extract_component::ExtractComponent,
|
||||||
render_resource::{AsBindGroup, RenderPipelineDescriptor, ShaderRef},
|
render_resource::{AsBindGroup, RenderPipelineDescriptor, ShaderRef},
|
||||||
};
|
};
|
||||||
|
use derive_more::derive::From;
|
||||||
|
|
||||||
/// Materials are used alongside [`UiMaterialPlugin`](crate::UiMaterialPlugin) and [`MaterialNodeBundle`](crate::prelude::MaterialNodeBundle)
|
/// Materials are used alongside [`UiMaterialPlugin`](crate::UiMaterialPlugin) and [`MaterialNodeBundle`](crate::prelude::MaterialNodeBundle)
|
||||||
/// to spawn entities that are rendered with a specific [`UiMaterial`] type. They serve as an easy to use high level
|
/// to spawn entities that are rendered with a specific [`UiMaterial`] type. They serve as an easy to use high level
|
||||||
|
@ -152,7 +153,9 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component, Clone, Debug, Deref, DerefMut, Reflect, PartialEq, Eq, ExtractComponent)]
|
#[derive(
|
||||||
|
Component, Clone, Debug, Deref, DerefMut, Reflect, PartialEq, Eq, ExtractComponent, From,
|
||||||
|
)]
|
||||||
#[reflect(Component, Default)]
|
#[reflect(Component, Default)]
|
||||||
pub struct UiMaterialHandle<M: UiMaterial>(pub Handle<M>);
|
pub struct UiMaterialHandle<M: UiMaterial>(pub Handle<M>);
|
||||||
|
|
||||||
|
@ -162,12 +165,6 @@ impl<M: UiMaterial> Default for UiMaterialHandle<M> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: UiMaterial> From<Handle<M>> for UiMaterialHandle<M> {
|
|
||||||
fn from(handle: Handle<M>) -> Self {
|
|
||||||
Self(handle)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<M: UiMaterial> From<UiMaterialHandle<M>> for AssetId<M> {
|
impl<M: UiMaterial> From<UiMaterialHandle<M>> for AssetId<M> {
|
||||||
fn from(material: UiMaterialHandle<M>) -> Self {
|
fn from(material: UiMaterialHandle<M>) -> Self {
|
||||||
material.id()
|
material.id()
|
||||||
|
|
|
@ -12,8 +12,8 @@ use bevy_sprite::BorderRect;
|
||||||
use bevy_utils::warn_once;
|
use bevy_utils::warn_once;
|
||||||
use bevy_window::{PrimaryWindow, WindowRef};
|
use bevy_window::{PrimaryWindow, WindowRef};
|
||||||
use core::num::NonZero;
|
use core::num::NonZero;
|
||||||
|
use derive_more::derive::{Display, Error, From};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
/// Base component for a UI node, which also provides the computed size of the node.
|
/// Base component for a UI node, which also provides the computed size of the node.
|
||||||
///
|
///
|
||||||
|
@ -1333,7 +1333,7 @@ impl Default for GridTrack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Debug, Reflect, From)]
|
||||||
#[reflect(Default, PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
|
@ -1363,12 +1363,6 @@ impl Default for GridTrackRepetition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<u16> for GridTrackRepetition {
|
|
||||||
fn from(count: u16) -> Self {
|
|
||||||
Self::Count(count)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<i32> for GridTrackRepetition {
|
impl From<i32> for GridTrackRepetition {
|
||||||
fn from(count: i32) -> Self {
|
fn from(count: i32) -> Self {
|
||||||
Self::Count(count as u16)
|
Self::Count(count as u16)
|
||||||
|
@ -1784,11 +1778,11 @@ fn try_into_grid_span(span: u16) -> Result<Option<NonZero<u16>>, GridPlacementEr
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Errors that occur when setting constraints for a `GridPlacement`
|
/// Errors that occur when setting constraints for a `GridPlacement`
|
||||||
#[derive(Debug, Eq, PartialEq, Clone, Copy, Error)]
|
#[derive(Debug, Eq, PartialEq, Clone, Copy, Error, Display)]
|
||||||
pub enum GridPlacementError {
|
pub enum GridPlacementError {
|
||||||
#[error("Zero is not a valid grid position")]
|
#[display("Zero is not a valid grid position")]
|
||||||
InvalidZeroIndex,
|
InvalidZeroIndex,
|
||||||
#[error("Spans cannot be zero length")]
|
#[display("Spans cannot be zero length")]
|
||||||
InvalidZeroSpan,
|
InvalidZeroSpan,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue