mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-22 01:12:07 +00:00
Fix more small things
This commit is contained in:
parent
10b9faa30a
commit
b3806e66ad
@ -114,7 +114,7 @@ impl<'r> Data<'r> {
|
||||
/// use rocket::data::{Data, FromData, Outcome};
|
||||
/// use rocket::http::Status;
|
||||
/// # struct MyType;
|
||||
/// # #[derive(rocket::TypedError)]
|
||||
/// # #[derive(rocket::TypedError, Debug)]
|
||||
/// # struct MyError;
|
||||
///
|
||||
/// #[rocket::async_trait]
|
||||
|
@ -1,3 +1,5 @@
|
||||
use std::fmt;
|
||||
|
||||
use crate::catcher::TypedError;
|
||||
use crate::http::RawStr;
|
||||
use crate::request::{Request, local_cache};
|
||||
@ -182,7 +184,7 @@ pub type Outcome<'r, T, E = <T as FromData<'r>>::Error>
|
||||
/// use rocket::request::Request;
|
||||
/// use rocket::data::{self, Data, FromData};
|
||||
/// # struct MyType;
|
||||
/// # #[derive(rocket::TypedError)]
|
||||
/// # #[derive(rocket::TypedError, Debug)]
|
||||
/// # struct MyError;
|
||||
///
|
||||
/// #[rocket::async_trait]
|
||||
@ -312,7 +314,7 @@ pub type Outcome<'r, T, E = <T as FromData<'r>>::Error>
|
||||
#[crate::async_trait]
|
||||
pub trait FromData<'r>: Sized {
|
||||
/// The associated error to be returned when the guard fails.
|
||||
type Error: TypedError<'r> + 'r;
|
||||
type Error: TypedError<'r> + fmt::Debug + 'r;
|
||||
|
||||
/// Asynchronously validates, parses, and converts an instance of `Self`
|
||||
/// from the incoming request body data.
|
||||
|
@ -160,7 +160,7 @@ use crate::http::{uri::{Segments, error::PathError, fmt::Path}, Status};
|
||||
/// use rocket::TypedError;
|
||||
/// # #[allow(dead_code)]
|
||||
/// # struct MyParam<'r> { key: &'r str, value: usize }
|
||||
/// #[derive(TypedError)]
|
||||
/// #[derive(TypedError, Debug)]
|
||||
/// struct MyParamError<'a>(&'a str);
|
||||
///
|
||||
/// impl<'r> FromParam<'r> for MyParam<'r> {
|
||||
@ -192,7 +192,7 @@ use crate::http::{uri::{Segments, error::PathError, fmt::Path}, Status};
|
||||
/// # #[macro_use] extern crate rocket;
|
||||
/// # use rocket::request::FromParam;
|
||||
/// # use rocket::TypedError;
|
||||
/// # #[derive(TypedError)]
|
||||
/// # #[derive(TypedError, Debug)]
|
||||
/// # struct MyParamError<'a>(&'a str);
|
||||
/// # #[allow(dead_code)]
|
||||
/// # struct MyParam<'r> { key: &'r str, value: usize }
|
||||
@ -215,7 +215,7 @@ use crate::http::{uri::{Segments, error::PathError, fmt::Path}, Status};
|
||||
/// ```
|
||||
pub trait FromParam<'a>: Sized {
|
||||
/// The associated error to be returned if parsing/validation fails.
|
||||
type Error: TypedError<'a>;
|
||||
type Error: TypedError<'a> + fmt::Debug + 'a;
|
||||
|
||||
/// Parses and validates an instance of `Self` from a path parameter string
|
||||
/// or returns an `Error` if parsing or validation fails.
|
||||
@ -397,7 +397,7 @@ impl<'a, T: FromParam<'a>> FromParam<'a> for Option<T> {
|
||||
/// the `Utf8Error`.
|
||||
pub trait FromSegments<'r>: Sized {
|
||||
/// The associated error to be returned when parsing fails.
|
||||
type Error: TypedError<'r>;
|
||||
type Error: TypedError<'r> + fmt::Debug + 'r;
|
||||
|
||||
/// Parses an instance of `Self` from many dynamic path parameter strings or
|
||||
/// returns an `Error` if one cannot be parsed.
|
||||
|
@ -1,4 +1,5 @@
|
||||
use std::convert::Infallible;
|
||||
use std::fmt;
|
||||
use std::net::{IpAddr, SocketAddr};
|
||||
|
||||
use crate::catcher::TypedError;
|
||||
@ -36,7 +37,7 @@ pub type Outcome<S, E> = outcome::Outcome<S, E, E>;
|
||||
/// use rocket::request::{self, Request, FromRequest};
|
||||
/// # struct MyType;
|
||||
/// # use rocket::TypedError;
|
||||
/// # #[derive(TypedError)]
|
||||
/// # #[derive(TypedError, Debug)]
|
||||
/// # struct MyError;
|
||||
///
|
||||
/// #[rocket::async_trait]
|
||||
@ -408,7 +409,7 @@ pub type Outcome<S, E> = outcome::Outcome<S, E, E>;
|
||||
#[crate::async_trait]
|
||||
pub trait FromRequest<'r>: Sized {
|
||||
/// The associated error to be returned if derivation fails.
|
||||
type Error: TypedError<'r> + 'r;
|
||||
type Error: TypedError<'r> + fmt::Debug + 'r;
|
||||
|
||||
/// Derives an instance of `Self` from the incoming request metadata.
|
||||
///
|
||||
|
@ -367,7 +367,7 @@ use rocket::tokio::fs::File;
|
||||
# pub fn new(size: usize) -> PasteId<'static> { todo!() }
|
||||
# pub fn file_path(&self) -> PathBuf { todo!() }
|
||||
# }
|
||||
# #[derive(rocket::TypedError)]
|
||||
# #[derive(Debug, rocket::TypedError)]
|
||||
# pub struct InvalidPasteId;
|
||||
# impl<'a> FromParam<'a> for PasteId<'a> {
|
||||
# type Error = InvalidPasteId;
|
||||
@ -446,7 +446,7 @@ pub struct PasteId<'a>(Cow<'a, str>);
|
||||
# pub fn file_path(&self) -> PathBuf { todo!() }
|
||||
# }
|
||||
#
|
||||
# #[derive(rocket::TypedError)]
|
||||
# #[derive(Debug, rocket::TypedError)]
|
||||
# pub struct InvalidPasteId;
|
||||
# impl<'a> FromParam<'a> for PasteId<'a> {
|
||||
# type Error = InvalidPasteId;
|
||||
|
Loading…
Reference in New Issue
Block a user