♻️ Major code restructuring
This commit is contained in:
parent
a96e203bb3
commit
fa66d628a0
221 changed files with 228 additions and 315 deletions
34
src/base/action/page/before_prepare_body.rs
Normal file
34
src/base/action/page/before_prepare_body.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
use crate::prelude::*;
|
||||
use crate::BaseHandle;
|
||||
|
||||
use super::FnActionPage;
|
||||
|
||||
#[derive(BaseHandle)]
|
||||
pub struct BeforePrepareBody {
|
||||
f: FnActionPage,
|
||||
weight: Weight,
|
||||
}
|
||||
|
||||
impl ActionTrait for BeforePrepareBody {
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
}
|
||||
|
||||
impl BeforePrepareBody {
|
||||
pub fn new(f: FnActionPage) -> Self {
|
||||
BeforePrepareBody { f, weight: 0 }
|
||||
}
|
||||
|
||||
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn dispatch(page: &mut Page) {
|
||||
dispatch_actions((Self::static_handle(), None, None), |action| {
|
||||
(action_ref::<BeforePrepareBody>(&**action).f)(page)
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue