💥 Create actions using with() as constructor
This commit is contained in:
parent
c50cfa985f
commit
0989b35925
3 changed files with 20 additions and 12 deletions
|
|
@ -58,9 +58,11 @@ macro_rules! actions_for_component {
|
|||
|
||||
impl [<BeforePrepare $Component>] {
|
||||
#[allow(dead_code)]
|
||||
pub fn with_action(mut self, action: [<FnAction $Component>]) -> Self {
|
||||
self.action = Some(action);
|
||||
self
|
||||
pub fn with(action: [<FnAction $Component>]) -> Self {
|
||||
[<BeforePrepare $Component>] {
|
||||
action: Some(action),
|
||||
weight: 0,
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
|
@ -117,9 +119,11 @@ macro_rules! actions_for_component {
|
|||
|
||||
impl [<AfterPrepare $Component>] {
|
||||
#[allow(dead_code)]
|
||||
pub fn with_action(mut self, action: [<FnAction $Component>]) -> Self {
|
||||
self.action = Some(action);
|
||||
self
|
||||
pub fn with(action: [<FnAction $Component>]) -> Self {
|
||||
[<AfterPrepare $Component>] {
|
||||
action: Some(action),
|
||||
weight: 0,
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ impl ActionTrait for ActionAfterPrepareBody {
|
|||
}
|
||||
|
||||
impl ActionAfterPrepareBody {
|
||||
pub fn with_action(mut self, action: FnActionPage) -> Self {
|
||||
self.action = Some(action);
|
||||
self
|
||||
pub fn with(action: FnActionPage) -> Self {
|
||||
ActionAfterPrepareBody {
|
||||
action: Some(action),
|
||||
weight: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ impl ActionTrait for ActionBeforePrepareBody {
|
|||
}
|
||||
|
||||
impl ActionBeforePrepareBody {
|
||||
pub fn with_action(mut self, action: FnActionPage) -> Self {
|
||||
self.action = Some(action);
|
||||
self
|
||||
pub fn with(action: FnActionPage) -> Self {
|
||||
ActionBeforePrepareBody {
|
||||
action: Some(action),
|
||||
weight: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue