diff --git a/egui_demo_lib/Cargo.toml b/egui_demo_lib/Cargo.toml index 89bac26d..e4aa8a3f 100644 --- a/egui_demo_lib/Cargo.toml +++ b/egui_demo_lib/Cargo.toml @@ -30,7 +30,7 @@ criterion = { version = "0.3", default-features = false } [features] default = [] -http = ["image", "syntect", "epi/http"] +http = ["image", "epi/http"] persistence = ["epi/persistence", "serde"] [[bench]] diff --git a/egui_demo_lib/src/apps/http_app.rs b/egui_demo_lib/src/apps/http_app.rs index 6dee9f84..fd39a292 100644 --- a/egui_demo_lib/src/apps/http_app.rs +++ b/egui_demo_lib/src/apps/http_app.rs @@ -196,6 +196,7 @@ fn ui_resouce( // ---------------------------------------------------------------------------- // Syntax highlighting: +#[cfg(feature = "syntect")] fn syntax_highlighting(response: &Response) -> Option { let text = response.text.as_ref()?; let extension_and_rest: Vec<&str> = response.url.rsplitn(2, '.').collect(); @@ -204,8 +205,10 @@ fn syntax_highlighting(response: &Response) -> Option { } /// Lines of text fragments +#[cfg(feature = "syntect")] struct ColoredText(Vec>); +#[cfg(feature = "syntect")] impl ColoredText { /// e.g. `text_with_extension("fn foo() {}", "rs")` pub fn text_with_extension(text: &str, extension: &str) -> Option { @@ -247,6 +250,17 @@ impl ColoredText { } } +#[cfg(not(feature = "syntect"))] +fn syntax_highlighting(_: &Response) -> Option { + None +} +#[cfg(not(feature = "syntect"))] +struct ColoredText(); +#[cfg(not(feature = "syntect"))] +impl ColoredText { + pub fn ui(&self, _ui: &mut egui::Ui) {} +} + // ---------------------------------------------------------------------------- // Texture/image handling is very manual at the moment.