Skip to content

Commit

Permalink
Make access parsing case-insensitive.
Browse files Browse the repository at this point in the history
SVDs from Nordic are using `read-writeonce` instead of `read-writeOnce`.
  • Loading branch information
Dirbaio committed Nov 14, 2024
1 parent 909a68b commit 8426f3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions svd-rs/src/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ impl Default for Access {
impl Access {
/// Parse a string into an [`Access`] value, returning [`Option::None`] if the string is not valid.
pub fn parse_str(s: &str) -> Option<Self> {
match s {
match s.to_ascii_lowercase().as_str() {
"read-only" => Some(Self::ReadOnly),
"read-write" => Some(Self::ReadWrite),
"read-writeOnce" => Some(Self::ReadWriteOnce),
"read-writeonce" => Some(Self::ReadWriteOnce),
"write-only" => Some(Self::WriteOnly),
"writeOnce" => Some(Self::WriteOnce),
"writeonce" => Some(Self::WriteOnce),
_ => None,
}
}
Expand Down

0 comments on commit 8426f3b

Please sign in to comment.