💥 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>] {
|
impl [<BeforePrepare $Component>] {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn with_action(mut self, action: [<FnAction $Component>]) -> Self {
|
pub fn with(action: [<FnAction $Component>]) -> Self {
|
||||||
self.action = Some(action);
|
[<BeforePrepare $Component>] {
|
||||||
self
|
action: Some(action),
|
||||||
|
weight: 0,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
@ -117,9 +119,11 @@ macro_rules! actions_for_component {
|
||||||
|
|
||||||
impl [<AfterPrepare $Component>] {
|
impl [<AfterPrepare $Component>] {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn with_action(mut self, action: [<FnAction $Component>]) -> Self {
|
pub fn with(action: [<FnAction $Component>]) -> Self {
|
||||||
self.action = Some(action);
|
[<AfterPrepare $Component>] {
|
||||||
self
|
action: Some(action),
|
||||||
|
weight: 0,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,11 @@ impl ActionTrait for ActionAfterPrepareBody {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActionAfterPrepareBody {
|
impl ActionAfterPrepareBody {
|
||||||
pub fn with_action(mut self, action: FnActionPage) -> Self {
|
pub fn with(action: FnActionPage) -> Self {
|
||||||
self.action = Some(action);
|
ActionAfterPrepareBody {
|
||||||
self
|
action: Some(action),
|
||||||
|
weight: 0,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, value: Weight) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,11 @@ impl ActionTrait for ActionBeforePrepareBody {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActionBeforePrepareBody {
|
impl ActionBeforePrepareBody {
|
||||||
pub fn with_action(mut self, action: FnActionPage) -> Self {
|
pub fn with(action: FnActionPage) -> Self {
|
||||||
self.action = Some(action);
|
ActionBeforePrepareBody {
|
||||||
self
|
action: Some(action),
|
||||||
|
weight: 0,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, value: Weight) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue