Skip to content

Commit 5ec263e

Browse files
authored
Bring tide to root, and allow cargo run --example (#247)
Bring tide to root, and allow `cargo run --example`
2 parents 3799be6 + 731e27a commit 5ec263e

26 files changed

+79
-105
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ matrix:
5050
--no-default-features
5151
- cargo build
5252
-Zmtime-on-use
53-
--manifest-path tide/Cargo.toml
5453
--no-default-features
5554

5655
- name: cargo test

Cargo.toml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,63 @@
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+
[features]
22+
default = ["hyper", "cookies"]
23+
cookies = ["tide-cookies"]
24+
hyper = ["tide-core/http-service-hyper"]
25+
26+
[dependencies]
27+
futures-preview = "0.3.0-alpha.16"
28+
http = "0.1"
29+
http-service = "0.2.0"
30+
serde = "1.0.91"
31+
serde_derive = "1.0.91"
32+
serde_urlencoded = "0.5.5"
33+
slog = "2.4.1"
34+
slog-async = "2.3.0"
35+
slog-term = "2.4.0"
36+
tide-cookies = { path = "./tide-cookies", optional = true }
37+
tide-core = { path = "./tide-core" }
38+
39+
[dependencies.multipart]
40+
default-features = false
41+
features = ["server"]
42+
version = "0.16.1"
43+
44+
[dev-dependencies]
45+
bytes = "0.4.12"
46+
cookie = { version = "0.12", features = ["percent-encode"] }
47+
futures-fs = "0.0.5"
48+
futures-util-preview = { version = "0.3.0-alpha.16", features = ["compat"] }
49+
http-service-mock = "0.2.0"
50+
juniper = "0.11.1"
51+
mime = "0.3.13"
52+
mime_guess = "2.0.0-alpha.6"
53+
percent-encoding = "1.0.1"
54+
serde = { version = "1.0.91", features = ["derive"] }
55+
156
[workspace]
257
members = [
3-
"tide",
458
"tide-compression",
559
"tide-cookies",
660
"tide-core",
7-
"examples",
861
]
962

1063
[patch.crates-io]

examples/Cargo.toml

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/src/body_types.rs renamed to examples/body_types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(async_await)]
12
use serde::{Deserialize, Serialize};
23
use tide::{
34
error::ResultExt,
@@ -35,7 +36,7 @@ async fn echo_form(mut cx: Context<()>) -> EndpointResult {
3536
Ok(forms::form(msg))
3637
}
3738

38-
pub fn main() {
39+
fn main() {
3940
let mut app = App::new();
4041

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

examples/src/catch_all.rs renamed to examples/catch_all.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
#![feature(async_await)]
12
use tide::Context;
23

34
async fn echo_path(cx: Context<()>) -> String {
45
let path: String = cx.param("path").unwrap();
56
format!("Your path is: {}", path)
67
}
78

8-
pub fn main() {
9+
fn main() {
910
let mut app = tide::App::new();
1011
app.at("/echo_path/*path").get(echo_path);
1112
app.run("127.0.0.1:8000").unwrap();

examples/src/cookies.rs renamed to examples/cookies.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(async_await)]
12
use cookie::Cookie;
23
use tide::{cookies::ContextExt, middleware::CookiesMiddleware, Context};
34

@@ -14,7 +15,7 @@ async fn remove_cookie(mut cx: Context<()>) {
1415
cx.remove_cookie(Cookie::named("hello")).unwrap();
1516
}
1617

17-
pub fn main() {
18+
fn main() {
1819
let mut app = tide::App::new();
1920
app.middleware(CookiesMiddleware::new());
2021

examples/src/default_headers.rs renamed to examples/default_headers.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
#![feature(async_await)]
2+
13
use tide::middleware::DefaultHeaders;
24

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

68
app.middleware(

examples/src/graphql.rs renamed to examples/graphql.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// a look at [the Juniper book].
33
//
44
// [the Juniper book]: https://graphql-rust.github.io/
5+
#![feature(async_await)]
56
use http::status::StatusCode;
67
use juniper::graphql_object;
78
use std::sync::{atomic, Arc};
@@ -56,7 +57,7 @@ async fn handle_graphql(mut cx: Context<Data>) -> EndpointResult {
5657
Ok(resp)
5758
}
5859

59-
pub fn main() {
60+
fn main() {
6061
let mut app = App::with_state(Data::default());
6162
app.at("/graphql").post(handle_graphql);
6263
app.run("127.0.0.1:8000").unwrap();

examples/src/hello.rs renamed to examples/hello.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
pub fn main() {
1+
#![feature(async_await)]
2+
fn main() {
23
let mut app = tide::App::new();
34
app.at("/").get(async move |_| "Hello, world!");
45
app.run("127.0.0.1:8000").unwrap();

examples/src/messages.rs renamed to examples/messages.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(async_await)]
2+
13
use http::status::StatusCode;
24
use serde::{Deserialize, Serialize};
35
use std::sync::Mutex;
@@ -62,7 +64,7 @@ async fn get_message(cx: Context<Database>) -> EndpointResult {
6264
}
6365
}
6466

65-
pub fn main() {
67+
fn main() {
6668
let mut app = App::with_state(Database::default());
6769
app.at("/message").post(new_message);
6870
app.at("/message/:id").get(get_message).post(set_message);

examples/src/multipart_form/mod.rs renamed to examples/multipart_form/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(async_await)]
12
use serde::{Deserialize, Serialize};
23
use std::io::Read;
34
use tide::{forms::ContextExt, response, App, Context, EndpointResult};

examples/src/lib.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/src/staticfile.rs renamed to examples/staticfile.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(async_await)]
2+
13
use bytes::Bytes;
24
use futures_fs::FsPool;
35
use futures_util::compat::*;
@@ -119,7 +121,7 @@ async fn handle_path(ctx: Context<StaticFile>) -> EndpointResult {
119121
})
120122
}
121123

122-
pub fn main() {
124+
fn main() {
123125
let mut app = App::with_state(StaticFile::new("./"));
124126
app.at("/*").get(handle_path);
125127
app.run("127.0.0.1:8000").unwrap();
File renamed without changes.
File renamed without changes.

tide/src/lib.rs renamed to src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//!
2020
2121
#[cfg(test)]
22-
#[doc(include = "../../README.md")]
22+
#[doc(include = "../README.md")]
2323
const _README: () = ();
2424

2525
#[macro_use]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tide-compression/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repository = "https://github.com/rustasync/tide"
1414
version = "0.1.0"
1515

1616
[dependencies]
17-
tide = { path = "../tide" }
17+
tide = { path = "../" }
1818
accept-encoding = "0.2.0-alpha.2"
1919
bytes = "0.4.12"
2020
futures-preview = "0.3.0-alpha.16"

tide-compression/examples/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async fn echo_bytes(mut cx: Context<()>) -> Vec<u8> {
1212
cx.body_bytes().await.unwrap()
1313
}
1414

15-
pub fn main() {
15+
fn main() {
1616
let mut app = App::new();
1717
app.at("/").get(lorem_ipsum);
1818
app.at("/echo").post(echo_bytes);

tide-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ optional = true
2424
version = "0.2.0"
2525

2626
[dev-dependencies]
27-
tide = { path = "../tide" }
27+
tide = { path = "../" }
2828
serde_derive = "1.0.91"
2929

3030
[features]

tide/Cargo.toml

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)