Skip to content

Commit 6c32451

Browse files
committed
merge cfg_attr serde
1 parent 97fc7ad commit 6c32451

12 files changed

+60
-24
lines changed

svd-rs/src/addressblock.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ pub struct AddressBlock {
1111
}
1212

1313
/// Usage of the address block.
14-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
15-
#[cfg_attr(feature = "serde", serde(rename_all = "kebab-case"))]
14+
#[cfg_attr(
15+
feature = "serde",
16+
derive(serde::Deserialize, serde::Serialize),
17+
serde(rename_all = "kebab-case")
18+
)]
1619
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1720
pub enum AddressBlockUsage {
1821
/// Registers

svd-rs/src/clusterinfo.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ pub enum Error {
1212
}
1313

1414
/// Description of a cluster
15-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
16-
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
15+
#[cfg_attr(
16+
feature = "serde",
17+
derive(serde::Deserialize, serde::Serialize),
18+
serde(rename_all = "camelCase")
19+
)]
1720
#[derive(Clone, Debug, PartialEq)]
1821
#[non_exhaustive]
1922
pub struct ClusterInfo {

svd-rs/src/cpu.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use super::{BuildError, Endian, SvdError, ValidateLevel};
22
/// CPU describes the processor included in the microcontroller device.
3-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
4-
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
3+
#[cfg_attr(
4+
feature = "serde",
5+
derive(serde::Deserialize, serde::Serialize),
6+
serde(rename_all = "camelCase")
7+
)]
58
#[derive(Clone, Debug, PartialEq)]
69
#[non_exhaustive]
710
pub struct Cpu {

svd-rs/src/device.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ pub enum Error {
1111
}
1212

1313
/// The top element in a SVD file. Describes information specific to a device.
14-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
15-
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
14+
#[cfg_attr(
15+
feature = "serde",
16+
derive(serde::Deserialize, serde::Serialize),
17+
serde(rename_all = "camelCase")
18+
)]
1619
#[derive(Clone, Debug, PartialEq)]
1720
#[non_exhaustive]
1821
pub struct Device {

svd-rs/src/dimelement.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ use super::{BuildError, EmptyToNone, SvdError, ValidateLevel};
22
use std::borrow::Cow;
33

44
/// Defines arrays and lists.
5-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
6-
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
5+
#[cfg_attr(
6+
feature = "serde",
7+
derive(serde::Deserialize, serde::Serialize),
8+
serde(rename_all = "camelCase")
9+
)]
710
#[derive(Clone, Debug, PartialEq)]
811
#[non_exhaustive]
912
pub struct DimElement {

svd-rs/src/endian.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/// Endianness of a [processor](crate::Cpu).
2-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
3-
#[cfg_attr(feature = "serde", serde(rename_all = "kebab-case"))]
2+
#[cfg_attr(
3+
feature = "serde",
4+
derive(serde::Deserialize, serde::Serialize),
5+
serde(rename_all = "kebab-case")
6+
)]
47
#[derive(Clone, Copy, Debug, PartialEq)]
58
pub enum Endian {
69
/// Little endian.

svd-rs/src/modifiedwritevalues.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
/// Describe the manipulation of data written to a register/field.
22
/// If not specified, the value written to the field is the value stored in the field
3-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
4-
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
3+
#[cfg_attr(
4+
feature = "serde",
5+
derive(serde::Deserialize, serde::Serialize),
6+
serde(rename_all = "camelCase")
7+
)]
58
#[derive(Clone, Copy, Debug, PartialEq)]
69
pub enum ModifiedWriteValues {
710
/// Write data bit of one shall clear (set to zero) the corresponding bit in the field

svd-rs/src/peripheralinfo.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ pub enum Error {
1313
}
1414

1515
/// A description of a peripheral in the [device](crate::Device), describing, for example, the [memory mappings](crate::RegisterInfo).
16-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
17-
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
16+
#[cfg_attr(
17+
feature = "serde",
18+
derive(serde::Deserialize, serde::Serialize),
19+
serde(rename_all = "camelCase")
20+
)]
1821
#[derive(Clone, Debug, PartialEq)]
1922
#[non_exhaustive]
2023
pub struct PeripheralInfo {

svd-rs/src/registercluster.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
use super::{Cluster, Register};
22

33
/// A [cluster](crate::Cluster) or a [register](crate::Register)
4-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
5-
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
4+
#[cfg_attr(
5+
feature = "serde",
6+
derive(serde::Deserialize, serde::Serialize),
7+
serde(rename_all = "lowercase")
8+
)]
69
#[derive(Clone, Debug, PartialEq)]
710
pub enum RegisterCluster {
811
/// Register

svd-rs/src/registerinfo.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ pub enum Error {
1212
}
1313

1414
/// A register is a named, programmable resource that belongs to a [peripheral](crate::Peripheral).
15-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
16-
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
15+
#[cfg_attr(
16+
feature = "serde",
17+
derive(serde::Deserialize, serde::Serialize),
18+
serde(rename_all = "camelCase")
19+
)]
1720
#[derive(Clone, Debug, PartialEq)]
1821
#[non_exhaustive]
1922
pub struct RegisterInfo {

0 commit comments

Comments
 (0)