Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename trait ExtractForms to ContextExt #239

Merged
merged 1 commit into from
May 20, 2019
Merged
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
2 changes: 1 addition & 1 deletion examples/src/body_types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use tide::{
error::ResultExt,
forms::{self, ExtractForms},
forms::{self, ContextExt},
response, App, Context, EndpointResult,
};

Expand Down
2 changes: 1 addition & 1 deletion examples/src/multipart_form/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
use std::io::Read;
use tide::{forms::ExtractForms, response, App, Context, EndpointResult};
use tide::{forms::ContextExt, response, App, Context, EndpointResult};

#[derive(Serialize, Deserialize, Clone)]
struct Message {
Expand Down
4 changes: 2 additions & 2 deletions tide/src/forms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ use crate::{
};

/// An extension trait for `Context`, providing form extraction.
pub trait ExtractForms {
pub trait ContextExt {
/// Asynchronously extract the entire body as a single form.
fn body_form<T: serde::de::DeserializeOwned>(&mut self) -> BoxTryFuture<T>;

/// Asynchronously extract the entire body as a multipart form.
fn body_multipart(&mut self) -> BoxTryFuture<Multipart<Cursor<Vec<u8>>>>;
}

impl<State: Send + Sync + 'static> ExtractForms for Context<State> {
impl<State: Send + Sync + 'static> ContextExt for Context<State> {
fn body_form<T: serde::de::DeserializeOwned>(&mut self) -> BoxTryFuture<T> {
let body = self.take_body();
box_async! {
Expand Down