Type Alias gotham_restful::AuthResult

source ·
pub type AuthResult<T, E> = Result<T, AuthErrorOrOther<E>>;
Expand description

This return type can be used to wrap any type implementing IntoResponse 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):

#[read_all]
fn read_all(auth: AuthStatus<MyAuthData>) -> AuthResult<NoContent, io::Error> {
	let auth_data = auth.ok()?;
	// do something
	Ok(NoContent::default().into())
}

Aliased Type§

enum AuthResult<T, E> {
    Ok(T),
    Err(AuthErrorOrOther<E>),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(AuthErrorOrOther<E>)

Contains the error value