mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Remove thiserror
from bevy_text
(#15762)
# Objective - Contributes to #15460 ## Solution - Removed `thiserror` from `bevy_text`
This commit is contained in:
parent
8718adc74f
commit
8fd3d54e48
3 changed files with 16 additions and 12 deletions
|
@ -30,7 +30,11 @@ bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
||||||
|
|
||||||
# other
|
# other
|
||||||
cosmic-text = { version = "0.12", features = ["shape-run-cache"] }
|
cosmic-text = { version = "0.12", features = ["shape-run-cache"] }
|
||||||
thiserror = "1.0"
|
derive_more = { version = "1", default-features = false, features = [
|
||||||
|
"error",
|
||||||
|
"from",
|
||||||
|
"display",
|
||||||
|
] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
unicode-bidi = "0.3.13"
|
unicode-bidi = "0.3.13"
|
||||||
sys-locale = "0.3.0"
|
sys-locale = "0.3.0"
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
use cosmic_text::CacheKey;
|
use cosmic_text::CacheKey;
|
||||||
use thiserror::Error;
|
use derive_more::derive::{Display, Error};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Error)]
|
#[derive(Debug, PartialEq, Eq, Error, Display)]
|
||||||
/// Errors related to the textsystem
|
/// Errors related to the textsystem
|
||||||
pub enum TextError {
|
pub enum TextError {
|
||||||
/// Font was not found, this could be that the font has not yet been loaded, or
|
/// Font was not found, this could be that the font has not yet been loaded, or
|
||||||
/// that the font failed to load for some other reason
|
/// that the font failed to load for some other reason
|
||||||
#[error("font not found")]
|
#[display("font not found")]
|
||||||
NoSuchFont,
|
NoSuchFont,
|
||||||
/// Failed to add glyph to a newly created atlas for some reason
|
/// Failed to add glyph to a newly created atlas for some reason
|
||||||
#[error("failed to add glyph to newly-created atlas {0:?}")]
|
#[display("failed to add glyph to newly-created atlas {_0:?}")]
|
||||||
|
#[error(ignore)]
|
||||||
FailedToAddGlyph(u16),
|
FailedToAddGlyph(u16),
|
||||||
/// Failed to get scaled glyph image for cache key
|
/// Failed to get scaled glyph image for cache key
|
||||||
#[error("failed to get scaled glyph image for cache key: {0:?}")]
|
#[display("failed to get scaled glyph image for cache key: {_0:?}")]
|
||||||
|
#[error(ignore)]
|
||||||
FailedToGetGlyphImage(CacheKey),
|
FailedToGetGlyphImage(CacheKey),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::Font;
|
use crate::Font;
|
||||||
use bevy_asset::{io::Reader, AssetLoader, LoadContext};
|
use bevy_asset::{io::Reader, AssetLoader, LoadContext};
|
||||||
use thiserror::Error;
|
use derive_more::derive::{Display, Error, From};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
/// An [`AssetLoader`] for [`Font`]s, for use by the [`AssetServer`](bevy_asset::AssetServer)
|
/// An [`AssetLoader`] for [`Font`]s, for use by the [`AssetServer`](bevy_asset::AssetServer)
|
||||||
|
@ -8,14 +8,12 @@ pub struct FontLoader;
|
||||||
|
|
||||||
/// Possible errors that can be produced by [`FontLoader`]
|
/// Possible errors that can be produced by [`FontLoader`]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error, Display, From)]
|
||||||
pub enum FontLoaderError {
|
pub enum FontLoaderError {
|
||||||
/// The contents that could not be parsed
|
/// The contents that could not be parsed
|
||||||
#[error(transparent)]
|
Content(cosmic_text::ttf_parser::FaceParsingError),
|
||||||
Content(#[from] cosmic_text::ttf_parser::FaceParsingError),
|
|
||||||
/// An [IO](std::io) Error
|
/// An [IO](std::io) Error
|
||||||
#[error(transparent)]
|
Io(std::io::Error),
|
||||||
Io(#[from] std::io::Error),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AssetLoader for FontLoader {
|
impl AssetLoader for FontLoader {
|
||||||
|
|
Loading…
Reference in a new issue