pub struct Action {
pub request: Request,
pub response: Response,
pub session: Session,
pub salt: Arc<String>,
pub module: String,
pub class: String,
pub action: String,
pub param: Option<String>,
pub cache: Cache,
pub db: Arc<DB>,
pub internal: bool,
pub tool: Tool,
/* private fields */
}
Expand description
Main struct to run web engine
§Values
request: Request
- Request from web server.response: Response
- Response to web server.session: Session
- Session data.salt: Arc<String>
- Secret salt.data: BTreeMap<i64, Data>
- Data transferred between controllers template markers and cache.pub module: String
- Start module name.pub class: String
- Start class name.pub action: String
- Start action (controller) name.param: Option<String>
- Start param.module_id: i64
- Module ID.class_id: i64,
- Class ID.action_id: i64
- Action ID.current_module_id: i64
- Current module ID.current_class_id: i64
- Current class ID.html: Option<Arc<BTreeMap<i64, Vec<Node>>>>
- Current templates.lang: Option<Arc<BTreeMap<i64, String>>>
- Current translates.engine: Arc<ActMap>
- Engine of server.language: Arc<Lang>
- All translates.template: Arc<Html>
- All templates.cache: Arc<Mutex<Cache>>
- Cache.db: Arc<DB>
- Database pool.mail: Arc<Mail>
- Mail function.internal: bool
- Internal call of controller.
Fields§
§request: Request
Request from web server
response: Response
Response to web server
session: Session
Session data
salt: Arc<String>
Secret salt
module: String
Start module name
class: String
Start class name
action: String
Start action (controller) name
param: Option<String>
Start param
cache: Cache
Cache
db: Arc<DB>
Database pool
internal: bool
Internal call of controller
tool: Tool
Different features
Implementations§
Source§impl Action
impl Action
Sourcepub async fn load(
&mut self,
key: impl StrOrI64,
module: impl StrOrI64,
class: impl StrOrI64,
action: impl StrOrI64,
param: Option<String>,
)
pub async fn load( &mut self, key: impl StrOrI64, module: impl StrOrI64, class: impl StrOrI64, action: impl StrOrI64, param: Option<String>, )
Load internal controller
Sourcepub async fn lang_current(&self) -> Arc<LangItem>
pub async fn lang_current(&self) -> Arc<LangItem>
Get current lang
Sourcepub async fn all_lang_list(&self) -> Vec<LangItem>
pub async fn all_lang_list(&self) -> Vec<LangItem>
Get vector of all languages
Sourcepub fn get<T>(&self, key: impl StrOrI64) -> Option<&T>
pub fn get<T>(&self, key: impl StrOrI64) -> Option<&T>
Getting references to data from internal memory
Sourcepub fn take<T>(&mut self, key: impl StrOrI64) -> Option<T>
pub fn take<T>(&mut self, key: impl StrOrI64) -> Option<T>
Taking (removing) data from internal memory
Sourcepub fn take_flash(&mut self) -> Option<Vec<(Flash, String)>>
pub fn take_flash(&mut self) -> Option<Vec<(Flash, String)>>
Take flash message from session data
Sourcepub fn set_lang_arr(&mut self, keys: &[impl StrOrI64])
pub fn set_lang_arr(&mut self, keys: &[impl StrOrI64])
Set an array of values for the template from the translation
Sourcepub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
Spawns a new asynchronous task, returning a
tokio::task::JoinHandle
for it.
The provided future will start running in the background immediately
when spawn
is called, even if you don’t await the returned
JoinHandle
.
Sourcepub async fn get_access(
&mut self,
module: impl StrOrI64,
class: impl StrOrI64,
action: impl StrOrI64,
) -> bool
pub async fn get_access( &mut self, module: impl StrOrI64, class: impl StrOrI64, action: impl StrOrI64, ) -> bool
Get access to run controller
Sourcepub async fn route(
&mut self,
module: &str,
class: &str,
action: &str,
param: Option<&str>,
lang_id: Option<i64>,
) -> String
pub async fn route( &mut self, module: &str, class: &str, action: &str, param: Option<&str>, lang_id: Option<i64>, ) -> String
Get route
Sourcepub async fn mail(&self, message: MailMessage) -> bool
pub async fn mail(&self, message: MailMessage) -> bool
Send email
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Action
impl !RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl !UnwindSafe for Action
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more