Skip to content

Commit a50668f

Browse files
authored
Merge pull request #219 from prasannavl/2019_05_tide_isolate_core
Precursor: Tide core isolation revamp
2 parents 4a53890 + d67ec8f commit a50668f

30 files changed

+125
-91
lines changed

Cargo.toml

+4-61
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,8 @@
1-
[package]
2-
authors = [
3-
"Aaron Turon <[email protected]>",
4-
"Yoshua Wuyts <[email protected]>",
1+
[workspace]
2+
members = [
3+
"tide",
4+
"examples",
55
]
6-
description = "WIP modular web framework"
7-
documentation = "https://docs.rs/tide"
8-
keywords = ["tide", "http", "web", "framework", "async"]
9-
categories = [
10-
"network-programming",
11-
"asynchronous",
12-
"web-programming::http-server"
13-
]
14-
edition = "2018"
15-
license = "MIT OR Apache-2.0"
16-
name = "tide"
17-
readme = "README.md"
18-
repository = "https://github.com/rustasync/tide"
19-
version = "0.2.0"
20-
21-
[dependencies]
22-
cookie = { version = "0.12", features = ["percent-encode"] }
23-
futures-preview = "0.3.0-alpha.16"
24-
fnv = "1.0.6"
25-
http = "0.1"
26-
http-service = "0.2.0"
27-
pin-utils = "0.1.0-alpha.4"
28-
route-recognizer = "0.1.12"
29-
serde = "1.0.91"
30-
serde_derive = "1.0.91"
31-
serde_json = "1.0.39"
32-
slog = "2.4.1"
33-
slog-async = "2.3.0"
34-
slog-term = "2.4.0"
35-
typemap = "0.3.3"
36-
serde_urlencoded = "0.5.5"
37-
38-
[dependencies.http-service-hyper]
39-
optional = true
40-
version = "0.2.0"
41-
42-
[dependencies.multipart]
43-
default-features = false
44-
features = ["server"]
45-
version = "0.16.1"
46-
47-
[features]
48-
default = ["hyper"]
49-
hyper = ["http-service-hyper"]
50-
51-
[dev-dependencies]
52-
basic-cookies = "0.1.3"
53-
bytes = "0.4.12"
54-
futures-fs = "0.0.5"
55-
futures-util-preview = { version = "0.3.0-alpha.16", features = ["compat"] }
56-
http-service-mock = "0.2.0"
57-
juniper = "0.11.1"
58-
mime = "0.3.13"
59-
mime_guess = "2.0.0-alpha.6"
60-
percent-encoding = "1.0.1"
61-
serde = { version = "1.0.90", features = ["derive"] }
62-
structopt = "0.2.15"
636

647
[patch.crates-io]
658
http-service = { git = "https://github.com/rustasync/http-service", branch = "master" }

examples/Cargo.toml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[package]
2+
authors = [
3+
"Tide Developers",
4+
]
5+
description = "Tide web server examples"
6+
documentation = "https://docs.rs/tide"
7+
edition = "2018"
8+
license = "MIT OR Apache-2.0"
9+
name = "examples"
10+
readme = "README.md"
11+
repository = "https://github.com/rustasync/tide"
12+
version = "0.1.0"
13+
publish = false
14+
15+
[dependencies]
16+
tide = { path = "../tide" }
17+
cookie = { version = "0.12", features = ["percent-encode"] }
18+
futures-preview = "0.3.0-alpha.16"
19+
fnv = "1.0.6"
20+
http = "0.1"
21+
http-service = "0.2.0"
22+
pin-utils = "0.1.0-alpha.4"
23+
route-recognizer = "0.1.12"
24+
serde_json = "1.0.39"
25+
slog = "2.4.1"
26+
slog-async = "2.3.0"
27+
slog-term = "2.4.0"
28+
typemap = "0.3.3"
29+
serde_urlencoded = "0.5.5"
30+
basic-cookies = "0.1.3"
31+
bytes = "0.4.12"
32+
futures-fs = "0.0.5"
33+
futures-util-preview = { version = "0.3.0-alpha.16", features = ["compat"] }
34+
http-service-mock = "0.2.0"
35+
juniper = "0.11.1"
36+
mime = "0.3.13"
37+
mime_guess = "2.0.0-alpha.6"
38+
percent-encoding = "1.0.1"
39+
serde = { version = "1.0.91", features = ["derive"] }
40+
structopt = "0.2.15"
41+
42+
[dependencies.multipart]
43+
default-features = false
44+
features = ["server"]
45+
version = "0.16.1"
46+

examples/body_types.rs examples/src/body_types.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(async_await)]
2-
31
use serde::{Deserialize, Serialize};
42
use tide::{
53
error::ResultExt,
@@ -41,7 +39,7 @@ async fn echo_form(mut cx: Context<()>) -> EndpointResult {
4139
Ok(forms::form(msg))
4240
}
4341

44-
fn main() {
42+
pub fn main() {
4543
let mut app = App::new();
4644

4745
app.at("/echo/string").post(echo_string);

examples/catch_all.rs examples/src/catch_all.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
#![feature(async_await)]
2-
31
use tide::Context;
42

53
async fn echo_path(cx: Context<()>) -> String {
64
let path: String = cx.param("path").unwrap();
75
format!("Your path is: {}", path)
86
}
97

10-
fn main() {
8+
pub fn main() {
119
let mut app = tide::App::new();
1210
app.at("/echo_path/*path").get(echo_path);
1311
app.serve("127.0.0.1:8000").unwrap();

examples/cookies.rs examples/src/cookies.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
#![feature(async_await)]
2-
31
use cookie::Cookie;
42
use tide::{cookies::ContextExt, middleware::CookiesMiddleware, Context};
53

64
/// Tide will use the the `Cookies`'s `Extract` implementation to build this parameter.
7-
///
85
async fn retrieve_cookie(mut cx: Context<()>) -> String {
96
format!("hello cookies: {:?}", cx.get_cookie("hello").unwrap())
107
}
@@ -19,7 +16,7 @@ async fn remove_cookie(mut cx: Context<()>) {
1916
cx.remove_cookie(Cookie::named("hello")).unwrap();
2017
}
2118

22-
fn main() {
19+
pub fn main() {
2320
let mut app = tide::App::new();
2421
app.middleware(CookiesMiddleware::new());
2522

examples/default_headers.rs examples/src/default_headers.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(async_await)]
2-
31
use tide::middleware::DefaultHeaders;
42

5-
fn main() {
3+
pub fn main() {
64
let mut app = tide::App::new();
75

86
app.middleware(

examples/graphql.rs examples/src/graphql.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// a look at [the Juniper book].
33
//
44
// [the Juniper book]: https://graphql-rust.github.io/
5-
6-
#![feature(async_await)]
7-
85
use http::status::StatusCode;
96
use juniper::graphql_object;
107
use std::sync::{atomic, Arc};
@@ -59,7 +56,7 @@ async fn handle_graphql(mut cx: Context<Data>) -> EndpointResult {
5956
Ok(resp)
6057
}
6158

62-
fn main() {
59+
pub fn main() {
6360
let mut app = App::with_state(Data::default());
6461
app.at("/graphql").post(handle_graphql);
6562
app.serve("127.0.0.1:8000").unwrap();

examples/hello.rs examples/src/hello.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![feature(async_await)]
2-
3-
fn main() {
1+
pub fn main() {
42
let mut app = tide::App::new();
53
app.at("/").get(async move |_| "Hello, world!");
64
app.serve("127.0.0.1:8000").unwrap();

examples/src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(async_await)]
2+
#![warn(clippy::all)]
3+
#![allow(dead_code)]
4+
5+
mod body_types;
6+
mod catch_all;
7+
mod cookies;
8+
mod default_headers;
9+
mod graphql;
10+
mod hello;
11+
mod messages;
12+
mod multipart_form;
13+
mod staticfile;

examples/messages.rs examples/src/messages.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(async_await)]
2-
31
use http::status::StatusCode;
42
use serde::{Deserialize, Serialize};
53
use std::sync::Mutex;
@@ -66,7 +64,7 @@ async fn get_message(cx: Context<Database>) -> EndpointResult {
6664
}
6765
}
6866

69-
fn main() {
67+
pub fn main() {
7068
let mut app = App::with_state(Database::default());
7169
app.at("/message").post(new_message);
7270
app.at("/message/:id").get(get_message).post(set_message);

examples/multipart-form/main.rs examples/src/multipart_form/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(async_await)]
2-
31
use serde::{Deserialize, Serialize};
42
use std::io::Read;
53
use tide::{forms::ExtractForms, response, App, Context, EndpointResult};
@@ -57,7 +55,7 @@ async fn upload_file(mut cx: Context<()>) -> EndpointResult {
5755
Ok(response::json(message))
5856
}
5957

60-
fn main() {
58+
pub fn run() {
6159
let mut app = App::new();
6260
app.at("/upload_file").post(upload_file);
6361
app.serve("127.0.0.1:8000").unwrap();
File renamed without changes.

examples/staticfile.rs examples/src/staticfile.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(async_await)]
2-
31
use bytes::Bytes;
42
use futures_fs::FsPool;
53
use futures_util::compat::*;
@@ -44,7 +42,7 @@ impl StaticFile {
4442
// Check if the path exists and handle if it's a directory containing `index.html`
4543
if meta.is_some() && meta.as_ref().map(|m| !m.is_file()).unwrap_or(false) {
4644
// Redirect if path is a dir and URL doesn't end with "/"
47-
if !actual_path.ends_with("/") {
45+
if !actual_path.ends_with('/') {
4846
return Ok(response
4947
.status(StatusCode::MOVED_PERMANENTLY)
5048
.header(header::LOCATION, String::from(actual_path) + "/")
@@ -121,7 +119,7 @@ async fn handle_path(ctx: Context<StaticFile>) -> EndpointResult {
121119
})
122120
}
123121

124-
fn main() {
122+
pub fn main() {
125123
let mut app = App::with_state(StaticFile::new("./"));
126124
app.at("/*").get(handle_path);
127125
app.serve("127.0.0.1:8000").unwrap();

tide/Cargo.toml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[package]
2+
authors = [
3+
"Aaron Turon <[email protected]>",
4+
"Yoshua Wuyts <[email protected]>",
5+
]
6+
description = "WIP modular web framework"
7+
documentation = "https://docs.rs/tide"
8+
keywords = ["tide", "http", "web", "framework", "async"]
9+
categories = [
10+
"network-programming",
11+
"asynchronous",
12+
"web-programming::http-server"
13+
]
14+
edition = "2018"
15+
license = "MIT OR Apache-2.0"
16+
name = "tide"
17+
readme = "README.md"
18+
repository = "https://github.com/rustasync/tide"
19+
version = "0.2.0"
20+
21+
[dependencies]
22+
cookie = { version = "0.12", features = ["percent-encode"] }
23+
futures-preview = "0.3.0-alpha.16"
24+
fnv = "1.0.6"
25+
http = "0.1"
26+
http-service = "0.2.0"
27+
pin-utils = "0.1.0-alpha.4"
28+
route-recognizer = "0.1.12"
29+
serde = "1.0.91"
30+
serde_derive = "1.0.91"
31+
serde_json = "1.0.39"
32+
slog = "2.4.1"
33+
slog-async = "2.3.0"
34+
slog-term = "2.4.0"
35+
typemap = "0.3.3"
36+
serde_urlencoded = "0.5.5"
37+
38+
[dependencies.http-service-hyper]
39+
optional = true
40+
version = "0.2.0"
41+
42+
[dependencies.multipart]
43+
default-features = false
44+
features = ["server"]
45+
version = "0.16.1"
46+
47+
[features]
48+
default = ["hyper"]
49+
hyper = ["http-service-hyper"]
50+
51+
[dev-dependencies]
52+
http-service-mock = "0.2.0"

src/app.rs tide/src/app.rs

File renamed without changes.

src/context.rs tide/src/context.rs

File renamed without changes.

src/cookies.rs tide/src/cookies.rs

File renamed without changes.
File renamed without changes.

src/error.rs tide/src/error.rs

File renamed without changes.

src/forms.rs tide/src/forms.rs

File renamed without changes.

src/lib.rs tide/src/lib.rs

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/route.rs tide/src/route.rs

File renamed without changes.

src/router.rs tide/src/router.rs

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)