mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-04-20 06:54:46 +00:00
docs: use [Type] syntax from rust 1.48
This commit is contained in:
parent
ed1bbbd1fb
commit
4ae860dd32
11 changed files with 71 additions and 70 deletions
|
@ -2,10 +2,7 @@ use gotham_restful_derive::ResourceError;
|
|||
|
||||
/**
|
||||
This is an error type that always yields a _403 Forbidden_ response. This type is best used in
|
||||
combination with [`AuthSuccess`] or [`AuthResult`].
|
||||
|
||||
[`AuthSuccess`]: type.AuthSuccess.html
|
||||
[`AuthResult`]: type.AuthResult.html
|
||||
combination with [AuthSuccess] or [AuthResult].
|
||||
*/
|
||||
#[derive(Debug, Clone, Copy, ResourceError)]
|
||||
pub enum AuthError {
|
||||
|
@ -15,9 +12,11 @@ pub enum AuthError {
|
|||
}
|
||||
|
||||
/**
|
||||
This return type can be used to map another `ResourceResult` that can only be returned if the
|
||||
client is authenticated. Otherwise, an empty _403 Forbidden_ response will be issued. Use can
|
||||
look something like this (assuming the `auth` feature is enabled):
|
||||
This return type can be used to map another [ResourceResult](crate::ResourceResult) that can
|
||||
only be returned if the client is authenticated. Otherwise, an empty _403 Forbidden_ response
|
||||
will be issued.
|
||||
|
||||
Use can look something like this (assuming the `auth` feature is enabled):
|
||||
|
||||
```rust
|
||||
# #[macro_use] extern crate gotham_restful_derive;
|
||||
|
@ -50,9 +49,7 @@ pub type AuthSuccess<T> = Result<T, AuthError>;
|
|||
|
||||
/**
|
||||
This is an error type that either yields a _403 Forbidden_ respone if produced from an authentication
|
||||
error, or delegates to another error type. This type is best used with [`AuthResult`].
|
||||
|
||||
[`AuthResult`]: type.AuthResult.html
|
||||
error, or delegates to another error type. This type is best used with [AuthResult].
|
||||
*/
|
||||
#[derive(Debug, ResourceError)]
|
||||
pub enum AuthErrorOrOther<E> {
|
||||
|
@ -83,9 +80,11 @@ where
|
|||
}
|
||||
|
||||
/**
|
||||
This return type can be used to map another `ResourceResult` that can only be returned if the
|
||||
client is authenticated. Otherwise, an empty _403 Forbidden_ response will be issued. Use can
|
||||
look something like this (assuming the `auth` feature is enabled):
|
||||
This return type can be used to map another [ResourceResult](crate::ResourceResult) that can
|
||||
only be returned if the client is authenticated. Otherwise, an empty _403 Forbidden_ response
|
||||
will be issued.
|
||||
|
||||
Use can look something like this (assuming the `auth` feature is enabled):
|
||||
|
||||
```
|
||||
# #[macro_use] extern crate gotham_restful_derive;
|
||||
|
|
|
@ -14,7 +14,7 @@ use std::{convert::Infallible, fmt::Display, pin::Pin};
|
|||
/**
|
||||
This type can be used both as a raw request body, as well as as a raw response. However, all types
|
||||
of request bodies are accepted by this type. It is therefore recommended to derive your own type
|
||||
from [`RequestBody`] and only use this when you need to return a raw response. This is a usage
|
||||
from [RequestBody] and only use this when you need to return a raw response. This is a usage
|
||||
example that simply returns its body:
|
||||
|
||||
```rust,no_run
|
||||
|
@ -35,8 +35,6 @@ fn create(body : Raw<Vec<u8>>) -> Raw<Vec<u8>> {
|
|||
# }));
|
||||
# }
|
||||
```
|
||||
|
||||
[`OpenapiType`]: trait.OpenapiType.html
|
||||
*/
|
||||
#[derive(Debug)]
|
||||
pub struct Raw<T> {
|
||||
|
|
|
@ -13,7 +13,7 @@ use std::{
|
|||
|
||||
/**
|
||||
This can be returned from a resource when there is no cause of an error. It behaves similar to a
|
||||
smart pointer like box, it that it implements `AsRef`, `Deref` and the likes.
|
||||
smart pointer like box, it that it implements [AsRef], [Deref] and the likes.
|
||||
|
||||
Usage example:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue