# Struct docserver::defs::req_handler::ReqHandler

source ·

    pub struct ReqHandler<'a> {
        pub req_header: ReqHeaderMap,
        pub app_dbs: &'a AppDBs,
        pub lang: Local,
        pub uri: &'a Uri,
        pub notify_data: UserNotifyData,
        pub auth_state: AuthState,
        pub req_name: String,
        pub context: Context,
    }

## Fields§

§ `req_header: ReqHeaderMap` § `app_dbs: &'a AppDBs` § `lang: Local` § `uri: &'a Uri` § `notify_data: UserNotifyData` § `auth_state: AuthState` § `req_name: String` § `context: Context`

## Implementations§

source §

### impl<'a> ReqHandler<'a>

source

#### pub fn new( req_header: ReqHeaderMap, app_dbs: &'a AppDBs, uri: &'a Uri, auth_state: &'a AuthState, req_name: &str ) -> Self

source

#### pub fn load_md_template_file( &mut self, tpl_path: &str, tpl_file: &str, in_html: bool, dflt_content: &str )

Find a `md` template file under `templates_path/md/server.name/req_path` or under `templates_path/md/req_path` render if found path or return `dflt_content`

source

#### pub fn template_file_dirpath(&self, tpl_file: &str) -> Result<String>

source

#### pub fn prepare_head_response(&self, res_header: &mut HeaderMap)

source

#### pub fn prepare_head_json_response(&self, res_header: &mut HeaderMap)

source

#### pub fn prepare_response(&mut self)

source

#### pub fn prepare_render(&mut self)

source

#### pub fn load_template_file( &mut self, tpl_file: &str, dflt_content: &str ) -> String

source

#### pub fn render_template( &mut self, template_file: &str, dflt_content: &str ) -> String

source

#### pub fn check_request_help(&mut self) -> Option<String>

source

#### pub fn check_request_invalid(&mut self, name: &str) -> Option<String>

source

#### pub fn check_request_auth(&mut self, _url_pathname: &str) -> Option<String>

source

#### pub fn bad_request(&mut self, msg: &str) -> String

source

#### pub fn response_tpl_msg(&mut self, tpl: &str, msg: &str) -> String

source

#### pub fn auth_role(&self) -> UserRole

source

#### pub fn get_config_lang(&self) -> Local

source

#### pub fn get_lang(&self, key: &str) -> Local

source

#### pub fn new_token(&self) -> String

source

#### pub fn has_auth_or_new(&self) -> String

source

#### pub fn otp_make(&self, code: &str, defs: &str) -> Result<TOTP>

source

#### pub fn otp_generate(&self) -> Result<TOTP>

source

#### pub fn otp_check(&self, code: &str, token: &str, defs: &str) -> Result<bool>

## Auto Trait Implementations§

§

### impl<'a> !RefUnwindSafe for ReqHandler<'a>

§

### impl<'a> Send for ReqHandler<'a>

§

### impl<'a> Sync for ReqHandler<'a>

§

### impl<'a> Unpin for ReqHandler<'a>

§

### impl<'a> !UnwindSafe for ReqHandler<'a>

## Blanket Implementations§

source §

### impl<T> Any for Twhere T: 'static + ?Sized,

source §

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
source §

### impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source §

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source §

### impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source §

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source §

### impl<T> From<T> for T

const: unstable · source §

#### fn from(t: T) -> T

Returns the argument unchanged.

source §

### impl<T> Instrument for T

source §

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. Read more
source §

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
source §

### impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source §

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

source §

### impl<T> Same<T> for T

§

#### type Output = T

Should always be `Self`
source §

### impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

#### type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source §

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source §

### impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source §

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

### impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

#### fn vzip(self) -> V

source §

### impl<T> WithSubscriber for T

source §

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more
source §

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more