From e2b0a1fd98a5daf7177bc5e47a45b5610723a7be Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Wed, 26 Jun 2024 10:18:13 +0200 Subject: [PATCH] Fix docs --- README.md | 18 ++++++++---------- feattle-ui/src/axum_ui.rs | 9 +++++---- feattle/README.md | 18 ++++++++---------- feattle/src/lib.rs | 7 ++++--- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 4c1e6e7..e8f894d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ Featture toggles for Rust (called "feattles", for short), extensible and with b synchronization and administration UI. ### Features - - Feature toggles that synchronize automatically with a backing storage - Feature toggles can be as simple `bool`, but can also be lists, maps and arbitrary tpes ( (through the [`FeattleValue`] trait). @@ -21,8 +20,6 @@ synchronization and administration UI. ### Example ```rust -use rusoto_s3::S3Client; -use rusoto_core::Region; use feattle::*; use std::sync::Arc; @@ -44,7 +41,9 @@ feattles! { #[tokio::main] async fn main() { // Store their values and history in AWS' S3 + use std::future::IntoFuture; use std::time::Duration; + use tokio::net::TcpListener; let config = aws_config::load_from_env().await; let persistence = Arc::new(S3::new( &config, @@ -64,9 +63,8 @@ async fn main() { // Or serve the admin panel with `axum` let router = axum_router(admin_panel); - tokio::spawn( - axum::Server::bind(&([127, 0, 0, 1], 3031).into()).serve(router.into_make_service()), - ); + let listener = TcpListener::bind(("127.0.0.1", 3031)).await.unwrap(); + tokio::spawn(axum::serve(listener, router.into_make_service()).into_future()); // Read values (note the use of `*`) assert_eq!(*my_feattles.is_cool(), true); @@ -139,10 +137,10 @@ provide a different storage or admin, you just need `feattle-core`. Licensed under either of -* Apache License, Version 2.0 - ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -* MIT license - ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + * Apache License, Version 2.0 + ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) + * MIT license + ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. diff --git a/feattle-ui/src/axum_ui.rs b/feattle-ui/src/axum_ui.rs index 5d9492a..9133824 100644 --- a/feattle-ui/src/axum_ui.rs +++ b/feattle-ui/src/axum_ui.rs @@ -26,11 +26,13 @@ struct EditFeattleForm { /// ```no_run /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { +/// use std::future::IntoFuture; /// use feattle_ui::{AdminPanel, axum_router}; /// use feattle_core::{feattles, Feattles}; /// use feattle_core::persist::NoPersistence; /// use std::sync::Arc; -/// use axum::Server; +/// +/// use tokio::net::TcpListener; /// /// feattles! { /// struct MyToggles { a: bool, b: i32 } @@ -42,9 +44,8 @@ struct EditFeattleForm { /// /// let router = axum_router(admin_panel); /// -/// Server::bind(&([127, 0, 0, 1], 3030).into()) -/// .serve(router.into_make_service()) -/// .await?; +/// let listener = TcpListener::bind(("127.0.0.1", 3031)).await?; +/// tokio::spawn(axum::serve(listener, router.into_make_service()).into_future()); /// /// # Ok(()) /// # } diff --git a/feattle/README.md b/feattle/README.md index 4c1e6e7..e8f894d 100644 --- a/feattle/README.md +++ b/feattle/README.md @@ -9,7 +9,6 @@ Featture toggles for Rust (called "feattles", for short), extensible and with b synchronization and administration UI. ### Features - - Feature toggles that synchronize automatically with a backing storage - Feature toggles can be as simple `bool`, but can also be lists, maps and arbitrary tpes ( (through the [`FeattleValue`] trait). @@ -21,8 +20,6 @@ synchronization and administration UI. ### Example ```rust -use rusoto_s3::S3Client; -use rusoto_core::Region; use feattle::*; use std::sync::Arc; @@ -44,7 +41,9 @@ feattles! { #[tokio::main] async fn main() { // Store their values and history in AWS' S3 + use std::future::IntoFuture; use std::time::Duration; + use tokio::net::TcpListener; let config = aws_config::load_from_env().await; let persistence = Arc::new(S3::new( &config, @@ -64,9 +63,8 @@ async fn main() { // Or serve the admin panel with `axum` let router = axum_router(admin_panel); - tokio::spawn( - axum::Server::bind(&([127, 0, 0, 1], 3031).into()).serve(router.into_make_service()), - ); + let listener = TcpListener::bind(("127.0.0.1", 3031)).await.unwrap(); + tokio::spawn(axum::serve(listener, router.into_make_service()).into_future()); // Read values (note the use of `*`) assert_eq!(*my_feattles.is_cool(), true); @@ -139,10 +137,10 @@ provide a different storage or admin, you just need `feattle-core`. Licensed under either of -* Apache License, Version 2.0 - ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -* MIT license - ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + * Apache License, Version 2.0 + ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) + * MIT license + ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. diff --git a/feattle/src/lib.rs b/feattle/src/lib.rs index 4f9543c..a59d125 100644 --- a/feattle/src/lib.rs +++ b/feattle/src/lib.rs @@ -34,7 +34,9 @@ //! #[tokio::main] //! async fn main() { //! // Store their values and history in AWS' S3 +//! use std::future::IntoFuture; //! use std::time::Duration; +//! use tokio::net::TcpListener; //! let config = aws_config::load_from_env().await; //! let persistence = Arc::new(S3::new( //! &config, @@ -54,9 +56,8 @@ //! //! // Or serve the admin panel with `axum` //! let router = axum_router(admin_panel); -//! tokio::spawn( -//! axum::Server::bind(&([127, 0, 0, 1], 3031).into()).serve(router.into_make_service()), -//! ); +//! let listener = TcpListener::bind(("127.0.0.1", 3031)).await.unwrap(); +//! tokio::spawn(axum::serve(listener, router.into_make_service()).into_future()); //! //! // Read values (note the use of `*`) //! assert_eq!(*my_feattles.is_cool(), true);