diff --git a/pty/src/cmdbuilder.rs b/pty/src/cmdbuilder.rs index 60f6f239c..ba3977176 100644 --- a/pty/src/cmdbuilder.rs +++ b/pty/src/cmdbuilder.rs @@ -2,6 +2,7 @@ use failure::{ensure, Error}; #[cfg(windows)] use log::error; +#[cfg(feature = "serde_support")] use serde_derive::*; use std::ffi::{OsStr, OsString}; #[cfg(windows)] @@ -9,7 +10,8 @@ use std::os::windows::ffi::OsStrExt; /// `CommandBuilder` is used to prepare a command to be spawned into a pty. /// The interface is intentionally similar to that of `std::process::Command`. -#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[derive(Debug, PartialEq)] +#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub struct CommandBuilder { args: Vec, envs: Vec<(OsString, OsString)>, diff --git a/pty/src/lib.rs b/pty/src/lib.rs index 47a304990..b93c12f1b 100644 --- a/pty/src/lib.rs +++ b/pty/src/lib.rs @@ -50,7 +50,8 @@ pub mod unix; pub mod win; /// Represents the size of the visible display area in the pty -#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq)] +#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub struct PtySize { /// The number of lines of text pub rows: u16,