corundum_framework/lib.rs
1//! `corundum-framework` — a single-dependency facade over the crates the sapphire apps and
2//! asteria share.
3//!
4//! Depend on this one crate and turn on the features you need; each feature re-exports a
5//! `corundum-framework-*` crate as a module, the same way sapphire-framework's facade does.
6//! The default is the part without egui, for the crates without a window (a server, a CLI);
7//! an app turns on `gui`.
8//!
9//! ```toml
10//! # A desktop app:
11//! corundum-framework = { version = "0.1", features = ["eframe", "serde"] }
12//! # The same app on an Android phone:
13//! corundum-framework = { version = "0.1", features = ["android", "serde"] }
14//! ```
15//!
16//! ## Modules (feature-gated)
17//!
18//! | feature | module | crate |
19//! |---|---|---|
20//! | `platform` (default) | [`platform`] | `corundum-framework-platform`: the app's directories, the system's languages, the JNI / Objective-C bridging |
21//! | `gui` | [`gui`] | `corundum-framework-gui`: the shell, theme, fonts, icons and translations (brings `platform`) |
22//! | `update` | [`update`] | `corundum-framework-update`: finding newer GitHub releases of an app's binary, and replacing it with one |
23//! | `self-update` | `update` | `update` with the download and the replacement; a store build leaves it off, as the store updates the app |
24//! | `package` | [`package`] | `corundum-framework-package`: the app as a Velopack package on the desktops: its start and install hooks, its updates, its command line on `PATH` and the Windows console shim (brings `platform`) |
25//! | `service` | [`service`] | `corundum-framework-service`: the app's background service registered with systemd, launchd or Task Scheduler at user level (brings `platform`) |
26//! | `keys` | [`keys`] | `corundum-framework-keys`: API keys for an app's server — a store of named keys, one file each, in a directory the app chooses, and their verification |
27//! | `keys-axum` | `keys::require_key` | the layer that checks a router's requests and resolves each key's profile with the app's function (brings `keys`) |
28//! | `keys-clap` | `keys::KeyCommand` | the subcommand that manages a store; `add --profile` takes one of the app's profiles (brings `keys`) |
29//! | `gui-keys` | `gui::keys` | the API keys page in Settings, over a store on this machine or the app's own backend; each key is added with one of the app's profiles (brings `gui` and `keys`) |
30//! | `gui-update` | `gui::update` | the gui crate's `update` panel: the Settings → About rows that look for a newer release (brings `gui` and `update`) |
31//! | `gui-self-update` | `gui::update` | the panel also downloads the release and replaces the running binary (brings `gui-update` and `self-update`) |
32//! | `gui-package` | `gui::update` | the panel's row for the app's own Velopack package, `Target::Package` (brings `gui-update` and `package`) |
33//! | `gui-service` | `gui::first_run::ServicePage`, `gui::settings::ServiceRow` | the gui crate's `service`: the first-run question whether to keep the app's services running, and an About-page row per service (brings `gui`, `service` and `serde`; desktops only) |
34//! | `eframe` | `gui::window::run`, [`eframe`] | `corundum-framework-gui` with its `eframe` feature: a desktop window started the same way for every app |
35//! | `android` | `gui::window::run_android`, [`eframe`] | `corundum-framework-gui` with its `android` feature: the window on an Android phone (brings `eframe`) |
36//! | `media-session` | `platform::media_session`, `gui::media_session` | the OS's media keys and its "now playing", for a music player; `gui::media_session::start` makes one for an eframe window (brings `platform`). An iOS app adds `UIBackgroundModes` `audio` to its Info.plist |
37//! | `single-instance` | `platform::instance`, `gui::window::WindowOptions::single_instance` | a desktop app run once: a second start brings the first's window to the front and exits (brings `platform`) |
38//! | `console` | `platform::console` | a Windows GUI-subsystem binary that also answers in a terminal without the package's console shim: `attach_parent` on a command-line start, not the window's (brings `platform`) |
39//! | `serde` | `gui::look`, `gui::store`, `gui::first_run` | `Serialize` / `Deserialize` on the gui's theme and language settings, and `store`: the look in effect and the rail's order, kept on the device in a TOML file and put back before the first frame; `first_run`, the first-run pages, which remember there that they were done |
40
41#[cfg(feature = "platform")]
42pub use corundum_framework_platform as platform;
43
44#[cfg(feature = "gui")]
45pub use corundum_framework_gui as gui;
46
47#[cfg(feature = "update")]
48pub use corundum_framework_update as update;
49
50#[cfg(feature = "package")]
51pub use corundum_framework_package as package;
52
53#[cfg(feature = "service")]
54pub use corundum_framework_service as service;
55
56#[cfg(feature = "keys")]
57pub use corundum_framework_keys as keys;
58
59// The egui the components are built against, at the top as well: an app that depends on
60// this facade alone renders with this one.
61#[cfg(feature = "gui")]
62pub use corundum_framework_gui::egui;
63
64// The eframe the window runs on, for the app's `eframe::App`; `android` brings `eframe`.
65#[cfg(feature = "eframe")]
66pub use corundum_framework_gui::eframe;