Skip to content

Commit

Permalink
box register/cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Nov 18, 2023
1 parent 4894fdf commit 982895f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions svd-parser/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ fn expand_register_cluster(
index: &Index,
) -> Result<()> {
match rc {
RegisterCluster::Cluster(c) => expand_cluster_array(regs, c, path, index)?,
RegisterCluster::Register(r) => expand_register_array(regs, r, path, index)?,
RegisterCluster::Cluster(c) => expand_cluster_array(regs, *c, path, index)?,
RegisterCluster::Register(r) => expand_register_array(regs, *r, path, index)?,
}
Ok(())
}
Expand Down
18 changes: 15 additions & 3 deletions svd-rs/src/registercluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,31 @@ use super::{Cluster, Register};
#[allow(clippy::large_enum_variant)]
pub enum RegisterCluster {
/// Register
Register(Register),
Register(Box<Register>),
/// Cluster
Cluster(Cluster),
Cluster(Box<Cluster>),
}

impl From<Register> for RegisterCluster {
fn from(reg: Register) -> Self {
Self::Register(reg)
Self::Register(Box::new(reg))
}
}

impl From<Cluster> for RegisterCluster {
fn from(cluser: Cluster) -> Self {
Self::Cluster(Box::new(cluser))
}
}

impl From<Box<Register>> for RegisterCluster {
fn from(reg: Box<Register>) -> Self {
Self::Register(reg)
}
}

impl From<Box<Cluster>> for RegisterCluster {
fn from(cluser: Box<Cluster>) -> Self {
Self::Cluster(cluser)
}
}
Expand Down

0 comments on commit 982895f

Please sign in to comment.