Skip to content

Commit

Permalink
chore: temporary template range + NextStep
Browse files Browse the repository at this point in the history
  • Loading branch information
m62624 committed Aug 29, 2023
1 parent 0da012e commit 3cae281
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
3 changes: 3 additions & 0 deletions flexible_inspect_rs/src/rules/common_elements/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub enum RangeFormat {
#[derive(Debug, Clone)]
pub enum RangeBoundaries {
I8(RangeInclusive<i8>),
I16(RangeInclusive<i16>),
I32(RangeInclusive<i32>),
I64(RangeInclusive<i64>),
I128(RangeInclusive<i128>),
Expand Down Expand Up @@ -73,6 +74,7 @@ impl Hash for RangeBoundaries {
fn hash<H: Hasher>(&self, state: &mut H) {
match self {
RangeBoundaries::I8(range) => range.hash(state),
RangeBoundaries::I16(range) => range.hash(state),
RangeBoundaries::I32(range) => range.hash(state),
RangeBoundaries::I64(range) => range.hash(state),
RangeBoundaries::I128(range) => range.hash(state),
Expand All @@ -92,6 +94,7 @@ impl PartialEq for RangeBoundaries {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(RangeBoundaries::I8(range1), RangeBoundaries::I8(range2)) => range1 == range2,
(RangeBoundaries::I16(range1), RangeBoundaries::I16(range2)) => range1 == range2,
(RangeBoundaries::I32(range1), RangeBoundaries::I32(range2)) => range1 == range2,
(RangeBoundaries::I64(range1), RangeBoundaries::I64(range2)) => range1 == range2,
(RangeBoundaries::I128(range1), RangeBoundaries::I128(range2)) => range1 == range2,
Expand Down
55 changes: 29 additions & 26 deletions flexible_inspect_rs/src/rules/next/number_range_status.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
// use super::*;
use super::*;

// pub fn number_range_status<R: RuleBase, C: PartialEq + Eq + Hash>(
// rule: &R,
// captures: &mut CaptureData<C>,
// ) -> NextStep {
// if let Some(rng) = rule.get_range() {
// match &rng.range {
// range::RangeBoundaries::I32(inner_range) => {

// },
// range::RangeBoundaries::I64(inner_range) => {

// },
// range::RangeBoundaries::I128(inner_range) => {

// },
// range::RangeBoundaries::F32(inner_range) => {

// },
// range::RangeBoundaries::F64(inner_range) => {

// },
// }
// }
// NextStep::Finish
// }
pub fn number_range_status<R: RuleBase, C: PartialEq + Eq + Hash>(
rule: &R,
captures: &mut CaptureData<C>,
) -> NextStep {
if let Some(rng) = rule.get_range() {
match &rng {
range::RangeFormat::Str(range_str) => match &range_str.range {
range::RangeBoundaries::I8(_) => todo!(),
range::RangeBoundaries::I16(_) => todo!(),
range::RangeBoundaries::I32(_) => todo!(),
range::RangeBoundaries::I64(_) => todo!(),
range::RangeBoundaries::I128(_) => todo!(),
range::RangeBoundaries::F32(_) => todo!(),
range::RangeBoundaries::F64(_) => todo!(),
},
range::RangeFormat::Bytes(range_bytes) => match &range_bytes.range {
range::RangeBoundaries::I8(_) => todo!(),
range::RangeBoundaries::I16(_) => todo!(),
range::RangeBoundaries::I32(_) => todo!(),
range::RangeBoundaries::I64(_) => todo!(),
range::RangeBoundaries::I128(_) => todo!(),
range::RangeBoundaries::F32(_) => todo!(),
range::RangeBoundaries::F64(_) => todo!(),
},
}
}
NextStep::Finish
}

0 comments on commit 3cae281

Please sign in to comment.