Skip to content

Commit

Permalink
default impl
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgb committed May 5, 2024
1 parent 9ba888a commit d3a2473
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stateroom-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ description = "Server for Stateroom services over WebSockets"
axum = { version = "0.7.5", features = ["ws"] }
dashmap = "5.5.3"
futures-util = "0.3.30"
stateroom = {path="../stateroom", version="0.4.0"}
stateroom = {path="../stateroom", version="0.4.1"}
tokio = { version = "1.37.0", features = ["rt-multi-thread"] }
tracing = "0.1.40"
2 changes: 1 addition & 1 deletion stateroom/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stateroom"
version = "0.4.1"
version = "0.4.2"
authors = ["Paul Butler <paulgb@gmail.com>"]
edition = "2018"
readme = "../README.md"
Expand Down
7 changes: 2 additions & 5 deletions stateroom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ pub trait StateroomServiceFactory: Send + Sync + 'static {
) -> Result<Self::Service, Self::Error>;
}

#[derive(Default)]
pub struct DefaultStateroomFactory<T: StateroomService + Default> {
_marker: std::marker::PhantomData<T>,
}
Expand All @@ -146,11 +147,7 @@ impl<T: StateroomService + Default> StateroomServiceFactory for DefaultStateroom
type Service = T;
type Error = Infallible;

fn build(
&self,
_: &str,
_: Arc<impl StateroomContext>,
) -> Result<Self::Service, Self::Error> {
fn build(&self, _: &str, _: Arc<impl StateroomContext>) -> Result<Self::Service, Self::Error> {
Ok(T::default())
}
}

0 comments on commit d3a2473

Please sign in to comment.