Skip to content

Commit 25329e8

Browse files
committed
Make simple types Copy/Clone/Eq.
1 parent cf08bce commit 25329e8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ pub struct Api {
190190
pub mod serial {
191191
/// Identities which sort of serial port each device represents.
192192
#[repr(C)]
193+
#[derive(Copy, Clone, PartialEq, Eq)]
193194
pub enum DeviceType {
194195
/// A MIDI interface
195196
Midi,
@@ -211,6 +212,7 @@ pub mod serial {
211212
/// Whether each word contains a parity bit, and if so, how it is
212213
/// calculated.
213214
#[repr(C)]
215+
#[derive(Copy, Clone, PartialEq, Eq)]
214216
pub enum Parity {
215217
/// An extra parity bit is added to each word. There will be an odd
216218
/// number of `1` bits in the new word (old word + parity bit). This
@@ -228,6 +230,7 @@ pub mod serial {
228230

229231
/// Whether to use hardware handshaking lines.
230232
#[repr(C)]
233+
#[derive(Copy, Clone, PartialEq, Eq)]
231234
pub enum Handshaking {
232235
/// No hardware handshaking - bytes will be dropped if there is an
233236
/// overflow
@@ -248,6 +251,7 @@ pub mod serial {
248251

249252
/// The number of stop bits after each word.
250253
#[repr(C)]
254+
#[derive(Copy, Clone, PartialEq, Eq)]
251255
pub enum StopBits {
252256
/// One stop bit is added to each word
253257
One,
@@ -257,6 +261,7 @@ pub mod serial {
257261

258262
/// The number of data bits in each word sent or received by the UART.
259263
#[repr(C)]
264+
#[derive(Copy, Clone, PartialEq, Eq)]
260265
pub enum DataBits {
261266
/// Each word comprises 7 data bits (plus start bit, stop bits and any
262267
/// parity bits)
@@ -268,6 +273,7 @@ pub mod serial {
268273

269274
/// A particular configuration for a serial port.
270275
#[repr(C)]
276+
#[derive(Clone)]
271277
pub struct Config {
272278
/// The desired transmission speed, in bits per second (also known as
273279
/// the 'baud rate'). Some hardware implementations allow a free choice
@@ -286,6 +292,7 @@ pub mod serial {
286292

287293
/// Information about a particular serial device.
288294
#[repr(C)]
295+
#[derive(Clone)]
289296
pub struct DeviceInfo {
290297
/// Some human-readable name for this serial device (e.g. `RS232` or
291298
/// `USB0`)

0 commit comments

Comments
 (0)