diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..0545544d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## Unreleased + +- Deprecated `SharedState::new` (since 0.2.0); construct via `inner.into()` + instead. diff --git a/README.md b/README.md index f22072f0..3730e278 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ connections and runs the Tokio event loop: WireframeServer::new(|| { WireframeApp::new() .frame_processor(MyFrameProcessor::new()) - .app_data(SharedState::new(state.clone())) + .app_data(state.clone().into()) .route(MessageType::Login, handle_login) .wrap(MyLoggingMiddleware::default()) }) diff --git a/docs/rust-binary-router-library-design.md b/docs/rust-binary-router-library-design.md index 7b6ef325..3b72a367 100644 --- a/docs/rust-binary-router-library-design.md +++ b/docs/rust-binary-router-library-design.md @@ -624,7 +624,7 @@ WireframeApp::new() .frame_processor(MyFrameProcessor::new()) // Configure the framing logic -.app_data(SharedState::new(app_state.clone())) // Shared application state +.app_data(app_state.clone().into()) // Shared application state //.service(login_handler) // If using attribute macros and auto-discovery diff --git a/src/extractor.rs b/src/extractor.rs index eaf02cfe..51ffec53 100644 --- a/src/extractor.rs +++ b/src/extractor.rs @@ -65,7 +65,7 @@ impl SharedState { /// use wireframe::extractor::SharedState; /// /// let data = Arc::new(5u32); - /// let state = SharedState::new(Arc::clone(&data)); + /// let state: SharedState = Arc::clone(&data).into(); /// assert_eq!(*state, 5); /// ``` #[must_use] @@ -78,9 +78,10 @@ impl SharedState { /// use wireframe::extractor::SharedState; /// /// let state = Arc::new(42); - /// let shared = SharedState::new(state.clone()); + /// let shared: SharedState = state.clone().into(); /// assert_eq!(*shared, 42); /// ``` + #[deprecated(since = "0.2.0", note = "construct via `inner.into()` instead")] pub fn new(inner: Arc) -> Self { Self(inner) } @@ -112,7 +113,7 @@ impl std::ops::Deref for SharedState { /// use wireframe::extractor::SharedState; /// /// let state = Arc::new(42); - /// let shared = SharedState::new(state.clone()); + /// let shared: SharedState = state.clone().into(); /// assert_eq!(*shared, 42); /// ``` fn deref(&self) -> &Self::Target {