diff --git a/Cargo.toml b/Cargo.toml index ac9ece3..f6824f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_fluent" -version = "0.9.0" +version = "0.10.0" authors = ["g "] edition = "2021" description = "Bevy plugin for localization using Fluent" @@ -18,7 +18,7 @@ categories = [ exclude = [".github/**/*"] [dependencies] -bevy = { version = "0.13.0", default-features = false, features = [ +bevy = { version = "0.14", default-features = false, features = [ "bevy_asset", ] } fluent = "0.16.0" @@ -36,5 +36,5 @@ unic-langid = { version = "0.9.4", features = ["serde"] } uuid = { version = "1.7.0", features = ["serde", "v4", "v5"] } [dev-dependencies] -bevy = "0.13.0" +bevy = "0.14" unic-langid = { version = "0.9.4", features = ["macros"] } diff --git a/README.md b/README.md index 586e62b..a5d6087 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ | bevy | bevy_fluent | | ---- | ----------- | +| 0.14 | 0.10 | | 0.13 | 0.9 | | 0.12 | 0.8 | | 0.11 | 0.7 | diff --git a/examples/ui/systems/menu.rs b/examples/ui/systems/menu.rs index 5d3c9ba..9c2430d 100644 --- a/examples/ui/systems/menu.rs +++ b/examples/ui/systems/menu.rs @@ -5,7 +5,7 @@ use crate::{ to_sentence_case::ToSentenceCase, GameState, }; -use bevy::prelude::*; +use bevy::{color::palettes::css, prelude::*}; use bevy_fluent::prelude::*; use fluent_content::Content; @@ -50,7 +50,7 @@ pub fn setup( align_items: AlignItems::Center, ..default() }, - background_color: Color::DARK_GRAY.into(), + background_color: css::DARK_GRAY.into(), ..default() }) .with_children(|parent| { @@ -93,7 +93,7 @@ pub fn setup( align_items: AlignItems::Center, ..default() }, - background_color: Color::GRAY.into(), + background_color: css::GRAY.into(), ..default() }, )) @@ -121,7 +121,7 @@ pub fn setup( align_items: AlignItems::Center, ..default() }, - background_color: Color::GRAY.into(), + background_color: css::GRAY.into(), ..default() }) .with_children(|parent| { @@ -150,7 +150,7 @@ pub fn setup( align_items: AlignItems::Center, ..default() }, - background_color: Color::GRAY.into(), + background_color: css::GRAY.into(), ..default() }, )) @@ -182,9 +182,9 @@ pub fn interaction( ) { for (interaction, mut color) in query.iter_mut() { *color = match interaction { - Interaction::Pressed => Color::DARK_GRAY.into(), - Interaction::Hovered => Color::SILVER.into(), - Interaction::None => Color::GRAY.into(), + Interaction::Pressed => css::DARK_GRAY.into(), + Interaction::Hovered => css::SILVER.into(), + Interaction::None => css::GRAY.into(), } } } diff --git a/src/assets/bundle.rs b/src/assets/bundle.rs index 8f62a47..517f05d 100644 --- a/src/assets/bundle.rs +++ b/src/assets/bundle.rs @@ -6,7 +6,7 @@ use bevy::{ asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext}, prelude::*, reflect::TypePath, - utils::{tracing::instrument, BoxedFuture}, + utils::tracing::instrument, }; use fluent::{bundle::FluentBundle, FluentResource}; use intl_memoizer::concurrent::IntlLangMemoizer; @@ -37,26 +37,24 @@ impl AssetLoader for BundleAssetLoader { type Settings = (); type Error = Error; - fn load<'a>( - &self, - reader: &'a mut Reader, + async fn load<'a>( + &'a self, + reader: &'a mut Reader<'_>, _: &'a Self::Settings, - load_context: &'a mut LoadContext, - ) -> BoxedFuture<'a, Result> { - Box::pin(async move { - let path = load_context.path(); - let mut content = String::new(); - reader.read_to_string(&mut content).await?; - match path.extension() { - Some(extension) if extension == "ron" => { - load(ron::de::from_str(&content)?, load_context).await - } - Some(extension) if extension == "yaml" || extension == "yml" => { - load(serde_yaml::from_str(&content)?, load_context).await - } - _ => unreachable!("We already check all the supported extensions."), + load_context: &'a mut LoadContext<'_>, + ) -> Result { + let path = load_context.path(); + let mut content = String::new(); + reader.read_to_string(&mut content).await?; + match path.extension() { + Some(extension) if extension == "ron" => { + load(ron::de::from_str(&content)?, load_context).await } - }) + Some(extension) if extension == "yaml" || extension == "yml" => { + load(serde_yaml::from_str(&content)?, load_context).await + } + _ => unreachable!("We already check all the supported extensions."), + } } fn extensions(&self) -> &[&str] { @@ -81,7 +79,7 @@ async fn load(data: Data, load_context: &mut LoadContext<'_>) -> Result().unwrap(); if let Err(errors) = bundle.add_resource(resource.0.clone()) { warn_span!("add_resource").in_scope(|| { diff --git a/src/assets/resource.rs b/src/assets/resource.rs index ed4ddde..3c2d4fd 100644 --- a/src/assets/resource.rs +++ b/src/assets/resource.rs @@ -5,7 +5,7 @@ use bevy::{ asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext}, prelude::*, reflect::TypePath, - utils::{tracing::instrument, BoxedFuture}, + utils::tracing::instrument, }; use fluent::FluentResource; use std::{ops::Deref, str, sync::Arc}; @@ -32,17 +32,15 @@ impl AssetLoader for ResourceAssetLoader { type Settings = (); type Error = Error; - fn load<'a>( - &self, - reader: &'a mut Reader, + async fn load<'a>( + &'a self, + reader: &'a mut Reader<'_>, _: &'a Self::Settings, - _: &'a mut LoadContext, - ) -> BoxedFuture<'a, Result> { - Box::pin(async move { - let mut content = String::new(); - reader.read_to_string(&mut content).await?; - Ok(ResourceAsset(deserialize(content))) - }) + _: &'a mut LoadContext<'_>, + ) -> Result { + let mut content = String::new(); + reader.read_to_string(&mut content).await?; + Ok(ResourceAsset(deserialize(content))) } fn extensions(&self) -> &[&str] {