@@ -139,6 +139,7 @@ impl From<Error> for io::Error {
139139/// Number of bits per character
140140#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
141141#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
142+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
142143pub enum DataBits {
143144 /// 5 bits per character
144145 Five ,
@@ -200,6 +201,7 @@ impl TryFrom<u8> for DataBits {
200201/// transmitted.
201202#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
202203#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
204+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
203205pub enum Parity {
204206 /// No parity bit.
205207 None ,
@@ -226,6 +228,7 @@ impl fmt::Display for Parity {
226228/// Stop bits are transmitted after every character.
227229#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
228230#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
231+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
229232pub enum StopBits {
230233 /// One stop bit.
231234 One ,
@@ -267,6 +270,7 @@ impl TryFrom<u8> for StopBits {
267270/// Flow control modes
268271#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
269272#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
273+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
270274pub enum FlowControl {
271275 /// No flow control.
272276 None ,
@@ -306,6 +310,7 @@ impl FromStr for FlowControl {
306310/// [`clear`]: trait.SerialPort.html#tymethod.clear
307311#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
308312#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
313+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
309314pub enum ClearBuffer {
310315 /// Specify to clear data received but not read
311316 Input ,
@@ -799,6 +804,7 @@ impl fmt::Debug for dyn SerialPort {
799804/// Contains all possible USB information about a `SerialPort`
800805#[ derive( Clone , PartialEq , Eq ) ]
801806#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
807+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
802808pub struct UsbPortInfo {
803809 /// Vendor ID
804810 pub vid : u16 ,
@@ -840,6 +846,7 @@ impl std::fmt::Debug for UsbPortInfo {
840846/// The physical type of a `SerialPort`
841847#[ derive( Debug , Clone , PartialEq , Eq ) ]
842848#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
849+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
843850pub enum SerialPortType {
844851 /// The serial port is connected via USB
845852 UsbPort ( UsbPortInfo ) ,
@@ -854,6 +861,7 @@ pub enum SerialPortType {
854861/// A device-independent implementation of serial port information
855862#[ derive( Debug , Clone , PartialEq , Eq ) ]
856863#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
864+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
857865pub struct SerialPortInfo {
858866 /// The short name of the serial port
859867 pub port_name : String ,
0 commit comments