Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Breaking Changes

- Raise MSRV to 1.75.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think removing async-trait is also a breaking change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good now?


## Release 0.9.0

### Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion crates/bounce-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ categories = ["wasm", "web-programming"]
readme = "README.md"
homepage = "https://github.com/bounce-rs/bounce"
license = "MIT OR Apache-2.0"
rust-version = "1.64"
rust-version = "1.75"

[lib]
proc-macro = true
Expand Down
5 changes: 2 additions & 3 deletions crates/bounce/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ categories = ["wasm", "web-programming"]
readme = "../../README.md"
homepage = "https://github.com/bounce-rs/bounce"
license = "MIT OR Apache-2.0"
rust-version = "1.64.0"
rust-version = "1.75.0"

[dependencies]
anymap2 = "0.13.0"
Expand All @@ -20,7 +20,6 @@ yew = "0.21"
bounce-macros = { path = "../bounce-macros", version = "0.9.0" }
futures = "0.3.28"

async-trait = { version = "0.1.68", optional = true }
gloo = { version = "0.10.0", features = ["futures"], optional = true }
html-escape = { version = "0.2.13", optional = true }
serde = { version = "1.0.164", features = ["derive"] }
Expand All @@ -42,7 +41,7 @@ features = [

[features]
ssr = ["html-escape"]
query = ["async-trait"]
query = []
helmet = ["gloo", "web-sys"]

[dev-dependencies]
Expand Down
39 changes: 2 additions & 37 deletions crates/bounce/src/query/traits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use async_trait::async_trait;
use std::hash::Hash;
use std::rc::Rc;

Expand All @@ -9,11 +8,6 @@ pub type QueryResult<T> = std::result::Result<Rc<T>, <T as Query>::Error>;

/// A trait to be implemented on queries.
///
/// # Note
///
/// This trait is implemented with [async_trait](macro@async_trait), you should apply an `#[async_trait(?Send)]`
/// attribute to your implementation of this trait.
///
/// # Example
///
/// ```
Expand All @@ -22,7 +16,6 @@ pub type QueryResult<T> = std::result::Result<Rc<T>, <T as Query>::Error>;
/// use bounce::prelude::*;
/// use bounce::query::{Query, QueryResult};
/// use yew::prelude::*;
/// use async_trait::async_trait;
///
/// #[derive(Debug, PartialEq)]
/// struct User {
Expand All @@ -35,7 +28,6 @@ pub type QueryResult<T> = std::result::Result<Rc<T>, <T as Query>::Error>;
/// value: User
/// }
///
/// #[async_trait(?Send)]
/// impl Query for UserQuery {
/// type Input = u64;
/// type Error = Infallible;
Expand All @@ -49,7 +41,6 @@ pub type QueryResult<T> = std::result::Result<Rc<T>, <T as Query>::Error>;
/// ```
///
/// See: [`use_query`](super::use_query()) and [`use_query_value`](super::use_query_value())
#[async_trait(?Send)]
pub trait Query: PartialEq {
/// The Input type of a query.
///
Expand All @@ -63,28 +54,14 @@ pub trait Query: PartialEq {
/// Runs a query.
///
/// This method will only be called when the result is not already cached.
///
/// # Note
///
/// When implementing this method with async_trait, you can use the following function
/// signature:
///
/// ```ignore
/// async fn query(states: &BounceStates, input: Rc<Self::Input>) -> QueryResult<Self>
/// ```
async fn query(states: &BounceStates, input: Rc<Self::Input>) -> QueryResult<Self>;
fn query(states: &BounceStates, input: Rc<Self::Input>) -> impl std::future::Future<Output = QueryResult<Self>>;
}

/// A Result returned by mutations.
pub type MutationResult<T> = std::result::Result<Rc<T>, <T as Mutation>::Error>;

/// A trait to be implemented on mutations.
///
/// # Note
///
/// This trait is implemented with [async_trait](macro@async_trait), you should apply an `#[async_trait(?Send)]`
/// attribute to your implementation of this trait.
///
/// # Example
///
/// ```
Expand All @@ -93,7 +70,6 @@ pub type MutationResult<T> = std::result::Result<Rc<T>, <T as Mutation>::Error>;
/// use bounce::prelude::*;
/// use bounce::query::{Mutation, MutationResult};
/// use yew::prelude::*;
/// use async_trait::async_trait;
///
/// #[derive(Debug, PartialEq)]
/// struct User {
Expand All @@ -105,7 +81,6 @@ pub type MutationResult<T> = std::result::Result<Rc<T>, <T as Mutation>::Error>;
/// struct UpdateUserMutation {
/// }
///
/// #[async_trait(?Send)]
/// impl Mutation for UpdateUserMutation {
/// type Input = User;
/// type Error = Infallible;
Expand All @@ -119,7 +94,6 @@ pub type MutationResult<T> = std::result::Result<Rc<T>, <T as Mutation>::Error>;
/// ```
///
/// See: [`use_mutation`](super::use_mutation())
#[async_trait(?Send)]
pub trait Mutation: PartialEq {
/// The Input type.
type Input: 'static;
Expand All @@ -128,14 +102,5 @@ pub trait Mutation: PartialEq {
type Error: 'static + std::error::Error + PartialEq + Clone;

/// Runs a mutation.
///
/// # Note
///
/// When implementing this method with async_trait, you can use the following function
/// signature:
///
/// ```ignore
/// async fn run(states: &BounceStates, input: Rc<Self::Input>) -> MutationResult<Self>
/// ```
async fn run(states: &BounceStates, input: Rc<Self::Input>) -> MutationResult<Self>;
fn run(states: &BounceStates, input: Rc<Self::Input>) -> impl std::future::Future<Output = MutationResult<Self>>;
}
2 changes: 0 additions & 2 deletions crates/bounce/src/query/use_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ where
/// use bounce::prelude::*;
/// use bounce::query::{Mutation, MutationResult, use_mutation, MutationState};
/// use yew::prelude::*;
/// use async_trait::async_trait;
/// use yew::platform::spawn_local;
///
/// #[derive(Debug, PartialEq)]
Expand All @@ -176,7 +175,6 @@ where
/// struct UpdateUserMutation {
/// }
///
/// #[async_trait(?Send)]
/// impl Mutation for UpdateUserMutation {
/// type Input = User;
/// type Error = Infallible;
Expand Down
2 changes: 0 additions & 2 deletions crates/bounce/src/query/use_prepared_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ use crate::utils::Id;
/// use bounce::prelude::*;
/// use bounce::query::{Query, QueryResult, use_prepared_query};
/// use yew::prelude::*;
/// use async_trait::async_trait;
/// use serde::{Serialize, Deserialize};
/// use thiserror::Error;
///
Expand All @@ -55,7 +54,6 @@ use crate::utils::Id;
/// value: User
/// }
///
/// #[async_trait(?Send)]
/// impl Query for UserQuery {
/// type Input = u64;
/// type Error = Never;
Expand Down
2 changes: 0 additions & 2 deletions crates/bounce/src/query/use_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ where
/// use bounce::prelude::*;
/// use bounce::query::{Query, QueryResult, use_query};
/// use yew::prelude::*;
/// use async_trait::async_trait;
///
/// #[derive(Debug, PartialEq)]
/// struct User {
Expand All @@ -183,7 +182,6 @@ where
/// value: User
/// }
///
/// #[async_trait(?Send)]
/// impl Query for UserQuery {
/// type Input = u64;
/// type Error = Infallible;
Expand Down
2 changes: 0 additions & 2 deletions crates/bounce/src/query/use_query_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ where
/// use bounce::prelude::*;
/// use bounce::query::{Query, QueryResult, use_query_value};
/// use yew::prelude::*;
/// use async_trait::async_trait;
///
/// #[derive(Debug, PartialEq)]
/// struct User {
Expand All @@ -185,7 +184,6 @@ where
/// value: User
/// }
///
/// #[async_trait(?Send)]
/// impl Query for UserQuery {
/// type Input = u64;
/// type Error = Infallible;
Expand Down
2 changes: 0 additions & 2 deletions crates/bounce/tests/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};

wasm_bindgen_test_configure!(run_in_browser);

use async_trait::async_trait;
use bounce::prelude::*;
use bounce::query::{use_query_value, Query, QueryResult};
use bounce::BounceRoot;
Expand Down Expand Up @@ -40,7 +39,6 @@ async fn test_query_requery_upon_state_change() {
inner: usize,
}

#[async_trait(?Send)]
impl Query for MyQuery {
type Input = ();
type Error = Infallible;
Expand Down
1 change: 0 additions & 1 deletion examples/queries-mutations/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ console_log = { version = "1.0.0", features = ["color"] }
reqwest = { version = "0.11.18", features = ["json"] }
serde = { version = "1.0.164", features = ["derive"] }
uuid = { version = "1.4.0", features = ["serde"] }
async-trait = "0.1.68"
wasm-bindgen = "0.2.87"

[dependencies.web-sys]
Expand Down
3 changes: 0 additions & 3 deletions examples/queries-mutations/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::rc::Rc;

use async_trait::async_trait;
use bounce::prelude::*;
use bounce::query::{
use_mutation, use_query, use_query_value, Mutation, MutationResult, MutationState, Query,
Expand Down Expand Up @@ -41,7 +40,6 @@ struct EchoResponse {
json: EchoMutation,
}

#[async_trait(?Send)]
impl Mutation for EchoMutation {
type Input = EchoInput;
type Error = Infallible;
Expand Down Expand Up @@ -69,7 +67,6 @@ struct UuidQuery {
uuid: Uuid,
}

#[async_trait(?Send)]
impl Query for UuidQuery {
type Input = ();
type Error = Infallible;
Expand Down
1 change: 0 additions & 1 deletion examples/queries-ssr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ console_log = { version = "1.0.0", features = ["color"] }
reqwest = { version = "0.11.18", features = ["json"] }
serde = { version = "1.0.164", features = ["derive"] }
uuid = { version = "1.4.0", features = ["serde"] }
async-trait = "0.1.68"
wasm-bindgen = "0.2.87"
thiserror = "1.0.40"

Expand Down
2 changes: 0 additions & 2 deletions examples/queries-ssr/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::rc::Rc;

use async_trait::async_trait;
use bounce::prelude::*;
use bounce::query::{use_prepared_query, Query, QueryResult};
use bounce::BounceRoot;
Expand All @@ -20,7 +19,6 @@ struct UuidQuery {
#[error("this will never happen.")]
struct Never {}

#[async_trait(?Send)]
impl Query for UuidQuery {
type Input = ();
type Error = Never;
Expand Down
Loading