Skip to content

Commit

Permalink
reduce redundancy in docs and make consistent (#272)
Browse files Browse the repository at this point in the history
also adds some extra example commands in tide-compression README
  • Loading branch information
fairingrey authored and yoshuawuyts committed Jun 7, 2019
1 parent a803151 commit 994ee1c
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ members = [
"tide-forms",
"tide-headers",
"tide-log",
"tide-panic",
"tide-querystring",
"tide-slog",
"tide-panic",
]

[patch.crates-io]
Expand Down
11 changes: 4 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//! Welcome to Tide.
//!
//! The [`App`](struct.App.html) docs are a good place to get started.
#![cfg_attr(any(feature = "nightly", test), feature(external_doc))]
#![cfg_attr(feature = "nightly", doc(include = "../README.md"))]
#![feature(async_await, existential_type)]
Expand All @@ -9,13 +13,6 @@
missing_docs
)]

//!
//! Welcome to Tide.
//!
//! The [`App`](struct.App.html) docs are a good place to get started.
//!
//!
#[cfg(test)]
#[doc(include = "../README.md")]
const _README: () = ();
Expand Down
7 changes: 5 additions & 2 deletions tide-compression/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ Examples are in the `/examples` folder of this crate.

__Simple Example__

You can test the simple example by running `cargo run --example simple` while in this crate's directory, and then running either of the following commands:
You can test the simple example by running `cargo run --example simple` while in this crate's directory, and then running any variety of the following commands:

```console
$ curl -v http://127.0.0.1:8000/
$ echo 'why hello there' | gzip | curl -v --compressed -H 'Content-Encoding: gzip' http://127.0.0.1:8000/echo --data-binary @-
$ curl -v -H 'Accept-Encoding: br' http://127.0.0.1:8000/
$ echo 'hello there' | gzip | curl -v --compressed -H 'Content-Encoding: gzip' http://127.0.0.1:8000/echo --data-binary @-
$ echo 'general kenobi' | brotli | curl -v --compressed -H 'Content-Encoding: br' http://127.0.0.1:8000/echo --data-binary @-
$ echo 'you are a bold one' | zstd | curl -v --compressed -H 'Content-Encoding: zstd' http://127.0.0.1:8000/echo --data-binary @-
```
2 changes: 0 additions & 2 deletions tide-cookies/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
missing_docs
)]

//! Cookie management for Tide web framework
mod data;
mod middleware;

Expand Down
6 changes: 0 additions & 6 deletions tide-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
// ISSUE: https://github.com/rust-lang/rust-clippy/issues/3988
#![allow(clippy::needless_lifetimes)]

//!
//! Tide core api document
//!
//! The [`App`] docs are a good place to get started.
//!
mod app;
mod context;
mod endpoint;
Expand Down
8 changes: 4 additions & 4 deletions tide-cors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This crate provides cors-related middleware for Tide.

Examples are in the `/examples` folder of this crate.

```rust
```rust,no_run
#![feature(async_await)]
use http::header::HeaderValue;
Expand All @@ -27,12 +27,12 @@ fn main() {
}
```

**Simple Example**
__Simple Example__

You can test the simple example by running `cargo run --example cors` while in this crate's directory, and then running this script in the browser console:

```console
fetch("http://127.0.0.1:8000")
$ fetch("http://127.0.0.1:8000")
```

You will probably get a browser alert when running without cors middleware
You will probably get a browser alert when running without cors middleware.
13 changes: 4 additions & 9 deletions tide-cors/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
//! Cors middleware and extensions for Tide
//!
//! # tide-cors
//!
//! This crate provides cors-related middleware for Tide.
//!
//! ## Examples
//!
//! Examples are in the `/examples` folder of this crate.
//!
//! ```rust, no_run
//! ```rust,no_run
//! #![feature(async_await)]
//!
//! use http::header::HeaderValue;
Expand All @@ -29,16 +25,15 @@
//! }
//! ```
//!
//! **Simple Example**
//! __Simple Example__
//!
//! You can test the simple example by running `cargo run --example cors` while in this crate's directory, and then running this script in the browser console:
//!
//! ```console
//! fetch("http://127.0.0.1:8000")
//! $ fetch("http://127.0.0.1:8000")
//! ```
//!
//! You will probably get a browser alert when running without cors middleware
//!
//! You will probably get a browser alert when running without cors middleware.
#![feature(async_await)]
#![warn(
Expand Down
12 changes: 6 additions & 6 deletions tide-panic/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//! Advanced panic support for Tide applications.
//!
//! These middleware should not generally be necessary, they are provided for situations in which
//! Tide's default panic handling is not usable by your application. Before using these you should
//! have a good understanding of how the different components involved in [`std::panic`] works.
#![feature(async_await, doc_cfg)]
#![warn(
nonstandard_style,
Expand All @@ -7,12 +13,6 @@
missing_docs
)]

//! Advanced panic support for Tide applications.
//!
//! These middleware should not generally be necessary, they are provided for situations in which
//! Tide's default panic handling is not usable by your application. Before using these you should
//! have a good understanding of how the different components involved in [`std::panic`] works.
mod catch_unwind;

pub use crate::catch_unwind::CatchUnwind;

0 comments on commit 994ee1c

Please sign in to comment.