Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"[rust]": {
"editor.formatOnSave": true
},
"rust-analyzer.cargo.allFeatures": true
"rust-analyzer.cargo.allFeatures": true,
"githubPullRequests.ignoredPullRequestBranches": [
"master"
]
}
28 changes: 13 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["rweb", "server", "http", "hyper"]
license = "Apache-2.0"
name = "rweb"
repository = "https://github.com/kdy1/rweb.git"
version = "0.15.0"
version = "0.15.2"

[package.metadata.docs.rs]
all-features = true
Expand All @@ -24,28 +24,26 @@ tls = ["warp/tls"]
websocket = ["warp/websocket"]

[dependencies]
chrono = {version = "0.4.19", features = ["serde"], optional = true}
enumset = {version = "1.0", features = ["serde"], optional = true}
chrono = { version = "0.4.19", features = ["serde"], optional = true }
enumset = { version = "1.0", features = ["serde"], optional = true }
futures = "0.3"
http = "0.2"
indexmap = "1"
rweb-macros = {version = "0.14.0", path = "./macros"}
rweb-openapi = {version = "0.7.0", optional = true}
indexmap = "1.9"
rweb-macros = { version = "0.14.0", path = "./macros" }
rweb-openapi = { version = "0.7.0", optional = true }
scoped-tls = "1"
serde = {version = "1", features = ["derive"]}
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = {version = "1.2", features = ["macros", "rt-multi-thread"]}
tokio = { version = "1.2", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1"
uuid = {version = "0.8", features = ["serde"], optional = true}
warp = {version = "0.3.0", default-features = false}
uuid = { version = "1.8", features = ["serde"], optional = true }
warp = { version = "0.3.7", default-features = false }

[dev-dependencies]
bytes = "1.0"
http = "0.2"
hyper = "0.14"
hyper = "1.3"
log = "0.4"
pretty_env_logger = "0.4"
serde_yaml = "0.8"
pretty_env_logger = "0.5"
serde_yaml = "0.9"

[[example]]
name = "openapi"
Expand Down
2 changes: 1 addition & 1 deletion examples/dyn_reply.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![deny(warnings)]

use http::StatusCode;
use rweb::*;
use warp::http::StatusCode;

#[get("/{word}")]
async fn dyn_reply(word: String) -> Result<Box<dyn warp::Reply>, warp::Rejection> {
Expand Down
10 changes: 5 additions & 5 deletions examples/todos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mod filters {
/// The 4 TODOs filters combined.
pub fn todos(
db: Db,
) -> impl Filter<Extract = impl rweb::Reply, Error = rweb::Rejection> + Clone {
) -> impl Filter<Extract = (impl rweb::Reply,), Error = rweb::Rejection> + Clone {
todos_list(db.clone())
.or(todos_create(db.clone()))
.or(todos_update(db.clone()))
Expand All @@ -50,7 +50,7 @@ mod filters {
/// GET /todos?offset=3&limit=5
pub fn todos_list(
db: Db,
) -> impl Filter<Extract = impl rweb::Reply, Error = rweb::Rejection> + Clone {
) -> impl Filter<Extract = (impl rweb::Reply,), Error = rweb::Rejection> + Clone {
rweb::path!("todos")
.and(rweb::get())
.and(rweb::query::<ListOptions>())
Expand All @@ -61,7 +61,7 @@ mod filters {
/// POST /todos with JSON body
pub fn todos_create(
db: Db,
) -> impl Filter<Extract = impl rweb::Reply, Error = rweb::Rejection> + Clone {
) -> impl Filter<Extract = (impl rweb::Reply,), Error = rweb::Rejection> + Clone {
rweb::path!("todos")
.and(rweb::post())
.and(json_body())
Expand All @@ -72,7 +72,7 @@ mod filters {
/// PUT /todos/:id with JSON body
pub fn todos_update(
db: Db,
) -> impl Filter<Extract = impl rweb::Reply, Error = rweb::Rejection> + Clone {
) -> impl Filter<Extract = (impl rweb::Reply,), Error = rweb::Rejection> + Clone {
rweb::path!("todos" / u64)
.and(rweb::put())
.and(json_body())
Expand All @@ -83,7 +83,7 @@ mod filters {
/// DELETE /todos/:id
pub fn todos_delete(
db: Db,
) -> impl Filter<Extract = impl rweb::Reply, Error = rweb::Rejection> + Clone {
) -> impl Filter<Extract = (impl rweb::Reply,), Error = rweb::Rejection> + Clone {
// We'll make one of our endpoints admin-only to show how authentication filters
// are used
let admin_only = rweb::header::exact("authorization", "Bearer admin");
Expand Down
4 changes: 2 additions & 2 deletions macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2018"
license = "Apache-2.0"
name = "rweb-macros"
repository = "https://github.com/kdy1/rweb.git"
version = "0.14.0"
version = "0.14.2"

[lib]
proc-macro = true
Expand All @@ -19,4 +19,4 @@ pmutil = "0.5.3"
proc-macro2 = "1"
quote = "1"
rweb-openapi = "0.6.0"
syn = {version = "1", features = ["full", "visit"]}
syn = { version = "1", features = ["full", "visit"] }
2 changes: 1 addition & 1 deletion macros/src/openapi/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ macro_rules! invalid_schema_usage {
"Invalid schema usage: {}
Correct usage: #[schema(description = \"foo\", example = \"bar\")]",
$act.dump()
);
)
};
}

Expand Down
2 changes: 1 addition & 1 deletion macros/src/openapi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ macro_rules! quote_str_indexmap {
Default::default(),
)
})
.collect();
.collect()
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/openapi/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,10 @@ impl ResponseEntity for Rejection {
}
}

type HttpError = http::Error;
type HttpError = warp::http::Error;
delegate_entity!(HttpError => ());

impl ResponseEntity for http::Error {
impl ResponseEntity for warp::http::Error {
fn describe_responses(_: &mut ComponentDescriptor) -> Responses {
Default::default()
}
Expand Down
4 changes: 2 additions & 2 deletions src/openapi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ pub use self::{
entity::{ComponentDescriptor, Entity, ResponseEntity, Responses},
};
use crate::FromRequest;
use http::Method;
use indexmap::IndexMap;
pub use rweb_openapi::v3_0::*;
use scoped_tls::scoped_thread_local;
use std::{borrow::Cow, cell::RefCell, mem::replace};
use warp::http::Method;

mod builder;
mod entity;
Expand Down Expand Up @@ -425,7 +425,7 @@ where
/// I'm too lazy to use inflector.
#[doc(hidden)]
pub mod http_methods {
use http::Method;
use warp::http::Method;

pub const fn get() -> Method {
Method::GET
Expand Down
2 changes: 1 addition & 1 deletion src/rt.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub use http::StatusCode;
pub use indexmap::{indexmap, IndexMap};
pub use serde_json;
use std::convert::Infallible;
pub use std::{borrow::Cow, clone::Clone, default::Default};
pub use tokio;
pub use warp::http::StatusCode;
use warp::{any, Filter};

pub fn provider<T: Clone + Send + Sync>(
Expand Down
2 changes: 1 addition & 1 deletion tests/body.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![cfg(not(feature = "openapi"))]

use bytes::Bytes;
use http::Error;
use rweb::{post, Filter};
use serde::{Deserialize, Serialize};
use warp::http::Error;

#[derive(Serialize, Deserialize)]
struct LoginForm {
Expand Down
2 changes: 1 addition & 1 deletion tests/factory.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg(not(feature = "openapi"))]

use http::StatusCode;
use rweb::{filters::BoxedFilter, *};
use serde::Deserialize;
use warp::http::StatusCode;

impl FromRequest for User {
type Filter = BoxedFilter<(User,)>;
Expand Down
2 changes: 1 addition & 1 deletion tests/header.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use http::StatusCode;
use rweb::*;
use warp::http::StatusCode;

#[get("/")]
fn ret_accept(#[header = "accept"] accept: String) -> String {
Expand Down
2 changes: 1 addition & 1 deletion tests/mixed.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg(not(feature = "openapi"))]

use http::Error;
use rweb::*;
use serde::{Deserialize, Serialize};
use warp::http::Error;

#[derive(Serialize, Deserialize)]
struct LoginForm {
Expand Down
2 changes: 1 addition & 1 deletion tests/path_arg.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg(not(feature = "openapi"))]

use http::Error;
use rweb::{get, Filter};
use warp::http::Error;

#[get("/")]
fn index() -> Result<String, Error> {
Expand Down
2 changes: 1 addition & 1 deletion tests/router.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use http::StatusCode;
use rweb::*;
use warp::http::StatusCode;

#[get("/sum/{a}/{b}")]
fn sum(a: usize, b: usize) -> String {
Expand Down