From c2ed9702ccff6d5c0c35e923a2e1c225ee99f2d5 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Tue, 8 Aug 2023 13:57:47 -0700 Subject: [PATCH] make qrcode stuff optional desktop --- Cargo.toml | 8 ++++---- src/lib.rs | 6 ++++-- src/{util.rs => qr_utils.rs} | 0 3 files changed, 8 insertions(+), 6 deletions(-) rename src/{util.rs => qr_utils.rs} (100%) diff --git a/Cargo.toml b/Cargo.toml index 0b54e54..1429058 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,15 +5,15 @@ edition = "2021" [features] default = ["desktop"] -desktop = ["dep:eframe", "dep:egui_extras"] +desktop = ["dep:clap", "dep:eframe", "dep:egui_extras", "dep:fast_qr", "dep:png"] [dependencies] -clap = { version = "4.3.19", features = ["derive", "env"] } +clap = { version = "4.3", optional = true, features = ["derive", "env"] } eframe = { version = "0.22", default-features = false, optional = true, features = ["default_fonts", "wgpu", "tts", "accesskit"] } egui_extras = { version = "0.22", default-features = false, optional = true, features = ["chrono", "image"] } env_logger = "*" -fast_qr = { version = "0.9", default-features = false, features = ["image"] } -png = "0.17.6" # pinning this to resolve conflict between eframe and fast_qr with the image crate +fast_qr = { version = "0.9", optional = true, default-features = false, features = ["image"] } +png = { version = "0.17.6", optional = true } # pinning this to resolve conflict between eframe and fast_qr with the image crate rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] } raptorq = "1.7" rkyv = { version = "0.7.42", features = ["validation"] } diff --git a/src/lib.rs b/src/lib.rs index 41c0190..9b09046 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,9 +7,11 @@ use rkyv::{Archive, Deserialize, Serialize}; #[cfg(feature = "desktop")] mod desktop; -mod util; +#[cfg(feature = "desktop")] +mod qr_utils; -pub use util::{get_content, mk_qr_bytes, stream_bytes}; +#[cfg(feature = "desktop")] +pub use qr_utils::{get_content, mk_qr_bytes, stream_bytes}; pub type CuttleSender = std::sync::mpsc::SyncSender>; pub type CuttleReceiver = std::sync::mpsc::Receiver>; diff --git a/src/util.rs b/src/qr_utils.rs similarity index 100% rename from src/util.rs rename to src/qr_utils.rs