We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2244ffb commit 822a680Copy full SHA for 822a680
svd-rs/src/writeconstraint.rs
@@ -34,10 +34,16 @@ pub enum Error {
34
/// The value is not in range.
35
#[error("Value {0} out of range {1:?}")]
36
OutOfRange(u64, core::ops::Range<u64>),
37
+ /// Minimum is greater than maximum.
38
+ #[error("Range minimum {0} is greater than maximum {1}")]
39
+ ReversedRange(u64, u64),
40
}
41
42
impl WriteConstraintRange {
43
pub(crate) fn check_range(&self, range: core::ops::Range<u64>) -> Result<(), SvdError> {
44
+ if self.min > self.max {
45
+ return Err(Error::ReversedRange(self.min, self.max).into());
46
+ }
47
for v in [&self.min, &self.max] {
48
if !range.contains(v) {
49
return Err(Error::OutOfRange(*v, range.clone()).into());
0 commit comments