Remove thiserror from bevy_sprite (#15763)

# Objective

- Contributes to #15460

## Solution

- Removed `thiserror` from `bevy_sprite`
This commit is contained in:
Zachary Harrold 2024-10-10 01:29:26 +11:00 committed by GitHub
parent b50f2ec334
commit ecd04c1b72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 12 deletions

View File

@ -37,7 +37,11 @@ bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" }
bytemuck = { version = "1", features = ["derive", "must_cast"] } bytemuck = { version = "1", features = ["derive", "must_cast"] }
fixedbitset = "0.5" fixedbitset = "0.5"
guillotiere = "0.6.0" guillotiere = "0.6.0"
thiserror = "1.0" derive_more = { version = "1", default-features = false, features = [
"error",
"from",
"display",
] }
rectangle-pack = "0.4" rectangle-pack = "0.4"
bitflags = "2.3" bitflags = "2.3"
radsort = "0.1" radsort = "0.1"

View File

@ -36,6 +36,7 @@ use bevy_render::{
use bevy_transform::components::{GlobalTransform, Transform}; use bevy_transform::components::{GlobalTransform, Transform};
use bevy_utils::tracing::error; use bevy_utils::tracing::error;
use core::{hash::Hash, marker::PhantomData}; use core::{hash::Hash, marker::PhantomData};
use derive_more::derive::From;
use crate::{ use crate::{
DrawMesh2d, Mesh2d, Mesh2dPipeline, Mesh2dPipelineKey, RenderMesh2dInstances, DrawMesh2d, Mesh2d, Mesh2dPipeline, Mesh2dPipelineKey, RenderMesh2dInstances,
@ -209,7 +210,7 @@ pub trait Material2d: AsBindGroup + Asset + Clone + Sized {
/// commands.spawn(Mesh2d(meshes.add(Circle::new(50.0)))); /// commands.spawn(Mesh2d(meshes.add(Circle::new(50.0))));
/// } /// }
/// ``` /// ```
#[derive(Component, Clone, Debug, Deref, DerefMut, Reflect, PartialEq, Eq)] #[derive(Component, Clone, Debug, Deref, DerefMut, Reflect, PartialEq, Eq, From)]
#[reflect(Component, Default)] #[reflect(Component, Default)]
#[require(HasMaterial2d)] #[require(HasMaterial2d)]
pub struct MeshMaterial2d<M: Material2d>(pub Handle<M>); pub struct MeshMaterial2d<M: Material2d>(pub Handle<M>);
@ -220,12 +221,6 @@ impl<M: Material2d> Default for MeshMaterial2d<M> {
} }
} }
impl<M: Material2d> From<Handle<M>> for MeshMaterial2d<M> {
fn from(handle: Handle<M>) -> Self {
Self(handle)
}
}
impl<M: Material2d> From<MeshMaterial2d<M>> for AssetId<M> { impl<M: Material2d> From<MeshMaterial2d<M>> for AssetId<M> {
fn from(material: MeshMaterial2d<M>) -> Self { fn from(material: MeshMaterial2d<M>) -> Self {
material.id() material.id()

View File

@ -9,19 +9,19 @@ use bevy_utils::{
tracing::{debug, error, warn}, tracing::{debug, error, warn},
HashMap, HashMap,
}; };
use derive_more::derive::{Display, Error};
use rectangle_pack::{ use rectangle_pack::{
contains_smallest_box, pack_rects, volume_heuristic, GroupedRectsToPlace, PackedLocation, contains_smallest_box, pack_rects, volume_heuristic, GroupedRectsToPlace, PackedLocation,
RectToInsert, TargetBin, RectToInsert, TargetBin,
}; };
use thiserror::Error;
use crate::{TextureAtlasLayout, TextureAtlasSources}; use crate::{TextureAtlasLayout, TextureAtlasSources};
#[derive(Debug, Error)] #[derive(Debug, Error, Display)]
pub enum TextureAtlasBuilderError { pub enum TextureAtlasBuilderError {
#[error("could not pack textures into an atlas within the given bounds")] #[display("could not pack textures into an atlas within the given bounds")]
NotEnoughSpace, NotEnoughSpace,
#[error("added a texture with the wrong format in an atlas")] #[display("added a texture with the wrong format in an atlas")]
WrongFormat, WrongFormat,
} }