Skip to content

Commit

Permalink
Derive more traits where appropriate.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Jul 9, 2024
1 parent 3d40d63 commit ab2615e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/device/sound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ impl From<RequestStatusCode> for VirtIOSndHdr {

/// A common header
#[repr(C)]
#[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Eq)]
#[derive(AsBytes, Clone, Debug, Eq, FromBytes, FromZeroes, PartialEq)]
struct VirtIOSndHdr {
command_code: u32,
}
Expand Down Expand Up @@ -1272,7 +1272,7 @@ pub enum NotificationType {
}

/// Notification from sound device.
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Notification {
notification_type: NotificationType,
data: u32,
Expand All @@ -1294,7 +1294,7 @@ const VIRTIO_SND_D_OUTPUT: u8 = 0;
const VIRTIO_SND_D_INPUT: u8 = 1;

#[repr(C)]
#[derive(AsBytes, FromBytes, FromZeroes)]
#[derive(AsBytes, Debug, FromBytes, FromZeroes)]
struct VirtIOSndQueryInfo {
/// specifies a particular item request type (VIRTIO_SND_R_*_INFO)
hdr: VirtIOSndHdr,
Expand All @@ -1313,7 +1313,7 @@ struct VirtIOSndQueryInfo {
}

#[repr(C)]
#[derive(AsBytes, FromBytes, FromZeroes)]
#[derive(AsBytes, Debug, FromBytes, FromZeroes)]
struct VirtIOSndQueryInfoRsp {
hdr: VirtIOSndHdr,
info: VirtIOSndInfo,
Expand All @@ -1327,7 +1327,7 @@ pub struct VirtIOSndInfo {
}

#[repr(C)]
#[derive(AsBytes, FromBytes, FromZeroes)]
#[derive(AsBytes, Clone, Debug, FromBytes, FromZeroes)]
struct VirtIOSndJackHdr {
hdr: VirtIOSndHdr,
/// specifies a jack identifier from 0 to jacks - 1
Expand All @@ -1336,7 +1336,7 @@ struct VirtIOSndJackHdr {

/// Jack infomation.
#[repr(C)]
#[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Eq)]
#[derive(AsBytes, Eq, FromBytes, FromZeroes, PartialEq)]
pub struct VirtIOSndJackInfo {
hdr: VirtIOSndInfo,
features: u32,
Expand Down Expand Up @@ -1444,7 +1444,7 @@ impl From<PcmSampleFormat> for u64 {

/// PCM information.
#[repr(C)]
#[derive(AsBytes, FromBytes, FromZeroes, Clone, Copy, PartialEq, Eq)]
#[derive(AsBytes, Clone, Eq, FromBytes, FromZeroes, PartialEq)]
pub struct VirtIOSndPcmInfo {
hdr: VirtIOSndInfo,
features: u32, /* 1 << VIRTIO_SND_PCM_F_XXX */
Expand Down Expand Up @@ -1477,7 +1477,7 @@ impl Display for VirtIOSndPcmInfo {
}
}

#[derive(Default)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
struct PcmParameters {
setup: bool,
buffer_bytes: u32,
Expand Down Expand Up @@ -1564,7 +1564,7 @@ enum ChannelPosition {
const VIRTIO_SND_CHMAP_MAX_SIZE: usize = 18;

#[repr(C)]
#[derive(FromBytes, FromZeroes, Debug)]
#[derive(Debug, FromBytes, FromZeroes)]
struct VirtIOSndChmapInfo {
hdr: VirtIOSndInfo,
direction: u8,
Expand Down

0 comments on commit ab2615e

Please sign in to comment.