Skip to content

Commit

Permalink
yaml_rust2
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Aug 10, 2024
1 parent d6b4e9d commit 226f9ce
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This changelog tracks the Rust `svdtools` project. See

## [Unreleased]

* Replace `yaml-rust` with `yaml-rust2`. Check for duplicate keys and other YAML parse errors
* Prevent collapsing columns in HTML `register-map-table` with `min-width`
* Protect from using one `enumeratedValues` in fields with different width

Expand Down
28 changes: 16 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@ name = "svdtools"
version = "0.3.17"
repository = "https://github.com/rust-embedded/svdtools/"
description = "Tool for modifying bugs in CMSIS SVD"
authors = [
"Andrey Zgarbul <[email protected]>",
"MarcoIeni"
]
authors = ["Andrey Zgarbul <[email protected]>", "MarcoIeni"]
categories = [
"command-line-utilities",
"embedded",
"hardware-support",
"no-std",
]
keywords = [
"svd",
"embedded",
"register",
]
keywords = ["svd", "embedded", "register"]
license = "MIT OR Apache-2.0"
readme = "README.md"
include = ["/res", "/src", "/tests", "CHANGELOG-rust.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
include = [
"/res",
"/src",
"/tests",
"CHANGELOG-rust.md",
"README.md",
"LICENSE-APACHE",
"LICENSE-MIT",
]
edition = "2021"
rust-version = "1.70"

Expand All @@ -31,13 +32,12 @@ quick-xml = { version = "0.31", features = ["serialize"] }
svd-rs = { version = "0.14.8", features = ["serde", "derive-from"] }
svd-parser = { version = "0.14.5", features = ["expand"] }
svd-encoder = "0.14.4"
yaml-rust = "0.4"
# serde_yaml 0.9.x looks broken
serde_yaml = "0.8.26"
serde_json = { version = "1.0", features = ["preserve_order"] }
anyhow = "1.0.65"
thiserror = "1.0.35"
linked-hash-map = "0.5"
hashlink = "0.8.4"
globset = "0.4.14"
commands = "0.0.5"
env_logger = "0.11"
Expand All @@ -50,6 +50,10 @@ regex = "1.10"
itertools = "0.12.0"
phf = { version = "0.11", features = ["macros"] }

[dependencies.yaml-rust]
package = "yaml-rust2"
version = "0.8"

[dev-dependencies]
similar = "2.5.0"
tempfile = "3.3"
2 changes: 2 additions & 0 deletions src/patch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use svd_parser::SVDError::DimIndexParse;
use svd_rs::{BitRange, DimArrayIndex, DimElement, DimElementBuilder, MaybeArray};
use yaml_rust::{yaml::Hash, Yaml, YamlLoader};

use hashlink::linked_hash_map;

use anyhow::{anyhow, Context, Result};
pub type PatchResult = anyhow::Result<()>;

Expand Down
2 changes: 1 addition & 1 deletion src/patch/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ fn collect_in_cluster(
cmod: &Hash,
config: &Config,
) -> PatchResult {
let mut rdict = linked_hash_map::LinkedHashMap::new();
let mut rdict = super::linked_hash_map::LinkedHashMap::new();
let mut first = None;
let mut dim = 0;
let mut dim_index = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion src/patch/yaml_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<'a> Iterator for OverStringIter<'a> {
}
}

type HashIter<'a> = OptIter<linked_hash_map::Iter<'a, Yaml, Yaml>>;
type HashIter<'a> = OptIter<super::linked_hash_map::Iter<'a, Yaml, Yaml>>;

pub trait GetVal {
fn get_yaml(&self, k: &str) -> Option<&Yaml>;
Expand Down

0 comments on commit 226f9ce

Please sign in to comment.