Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sitegui committed Jun 26, 2024
1 parent e371c0a commit e2b0a1f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 27 deletions.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -21,8 +20,6 @@ synchronization and administration UI.
### Example

```rust
use rusoto_s3::S3Client;
use rusoto_core::Region;
use feattle::*;
use std::sync::Arc;

Expand All @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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.

Expand Down
9 changes: 5 additions & 4 deletions feattle-ui/src/axum_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ struct EditFeattleForm {
/// ```no_run
/// # #[tokio::main]
/// # async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// 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 }
Expand All @@ -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(())
/// # }
Expand Down
18 changes: 8 additions & 10 deletions feattle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -21,8 +20,6 @@ synchronization and administration UI.
### Example

```rust
use rusoto_s3::S3Client;
use rusoto_core::Region;
use feattle::*;
use std::sync::Arc;

Expand All @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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.

Expand Down
7 changes: 4 additions & 3 deletions feattle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit e2b0a1f

Please sign in to comment.