Skip to content

Commit

Permalink
Add missing #[cfg(feature=...)]
Browse files Browse the repository at this point in the history
#[cfg(feature = "io")] for mod test

#[cfg(feature = "plist")] for Launchd.
Also added a bandaid with #[cfg(not(feature = "io"))]
type LaunchEvents = ();
  • Loading branch information
koenichiwa committed Aug 8, 2023
1 parent 3431f3a commit d871f53
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub use self::sockets::{BonjourType, Socket, SocketOptions, Sockets};

#[cfg(feature = "cron")]
use cron::{Schedule, TimeUnitSpec};
#[cfg(feature = "plist")]
use plist::Value;
#[cfg(feature = "io")]
use plist::{from_bytes, from_file, from_reader, from_reader_xml};
Expand Down Expand Up @@ -188,8 +189,13 @@ pub struct Launchd {
// Defined as a "<dictionary of dictionaries of dictionaries>" in launchd.plist(5)
// Use plist::Value as the value can be String, Integer, Boolean, etc.
// Doing this precludes the use of #[derive(Eq)] on the Launchd struct, but in practice "PartialEq" is fine.
#[cfg(feature = "plist")]
type LaunchEvents = HashMap<String, HashMap<String, HashMap<String, Value>>>;

// TODO: the current implementation is dependent on plist. Is this necessary?
#[cfg(not(feature = "plist"))]
type LaunchEvents = ();

/// Representation of a CalendarInterval
///
/// Usage:
Expand Down Expand Up @@ -798,6 +804,7 @@ impl CalendarInterval {
#[cfg(test)]
mod tests {

#[cfg(feature = "io")]
macro_rules! test_case {
($fname:expr) => {
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/resources/", $fname)
Expand Down

0 comments on commit d871f53

Please sign in to comment.