diff --git a/stateroom/src/lib.rs b/stateroom/src/lib.rs index c42b083..ecfd051 100644 --- a/stateroom/src/lib.rs +++ b/stateroom/src/lib.rs @@ -63,7 +63,7 @@ //! } //! } -use std::sync::Arc; +use std::{convert::Infallible, sync::Arc}; pub use client_id::ClientId; pub use message_recipient::MessageRecipient; @@ -137,3 +137,20 @@ pub trait StateroomServiceFactory: Send + Sync + 'static { context: Arc, ) -> Result; } + +pub struct DefaultStateroomFactory { + _marker: std::marker::PhantomData, +} + +impl StateroomServiceFactory for DefaultStateroomFactory { + type Service = T; + type Error = Infallible; + + fn build( + &self, + _: &str, + _: Arc, + ) -> Result { + Ok(T::default()) + } +}