Skip to content

Commit

Permalink
style: rename general
Browse files Browse the repository at this point in the history
Increase code readability
  • Loading branch information
tu6ge committed May 23, 2024
1 parent bead8f6 commit f92f9a5
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/rule/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,26 @@ mod private {
/// ```rust,ignore
/// Rule1.and(Rule2).and(Rule3)
/// ```
pub trait RuleExt<I, M>: private::Sealed<I> {
fn and<R>(self, other: R) -> RuleList<I, M>
pub trait RuleExt<Input, Msg>: private::Sealed<Input> {
fn and<R>(self, other: R) -> RuleList<Input, Msg>
where
R: CoreRule<I, (), Message = M>;
R: CoreRule<Input, (), Message = Msg>;

fn custom<F, V>(self, other: F) -> RuleList<I, M>
fn custom<F, V>(self, other: F) -> RuleList<Input, Msg>
where
F: for<'a> FnOnce(&'a mut V) -> Result<(), M>,
F: CoreRule<I, V, Message = M>,
F: for<'a> FnOnce(&'a mut V) -> Result<(), Msg>,
F: CoreRule<Input, V, Message = Msg>,
V: FromValue + 'static;
}

impl<R, M, I> RuleExt<I, M> for R
impl<R, Input, Msg> RuleExt<Input, Msg> for R
where
R: CoreRule<I, (), Message = M>,
M: 'static,
R: CoreRule<Input, (), Message = Msg>,
Msg: 'static,
{
fn and<R2>(self, other: R2) -> RuleList<I, M>
fn and<R2>(self, other: R2) -> RuleList<Input, Msg>
where
R2: CoreRule<I, (), Message = M>,
R2: CoreRule<Input, (), Message = Msg>,
{
let is_dup = {
if R::THE_NAME != R2::THE_NAME {
Expand All @@ -124,16 +124,16 @@ where
list: if is_dup {
vec![ErasedRule::new(self)]
} else {
vec![ErasedRule::<I, M>::new(self), ErasedRule::new(other)]
vec![ErasedRule::<Input, Msg>::new(self), ErasedRule::new(other)]
},
..Default::default()
}
}

fn custom<F, V>(self, other: F) -> RuleList<I, M>
fn custom<F, V>(self, other: F) -> RuleList<Input, Msg>
where
F: for<'a> FnOnce(&'a mut V) -> Result<(), M>,
F: CoreRule<I, V, Message = M>,
F: for<'a> FnOnce(&'a mut V) -> Result<(), Msg>,
F: CoreRule<Input, V, Message = Msg>,
V: FromValue + 'static,
{
RuleList {
Expand Down Expand Up @@ -409,12 +409,12 @@ pub trait IntoRuleList<I, M> {
}

/// load closure rule
pub fn custom<F, I, V, M>(f: F) -> RuleList<I, M>
pub fn custom<F, V, Input, Msg>(f: F) -> RuleList<Input, Msg>
where
F: for<'a> FnOnce(&'a mut V) -> Result<(), M>,
F: CoreRule<I, V, Message = M>,
F: for<'a> FnOnce(&'a mut V) -> Result<(), Msg>,
F: CoreRule<Input, V, Message = Msg>,
V: FromValue + 'static,
M: 'static,
Msg: 'static,
{
RuleList {
list: vec![ErasedRule::new(f)],
Expand Down

0 comments on commit f92f9a5

Please sign in to comment.