Trying to run examples as usual (and as described in the README) fails:
> cargo run --release --example cosmic
error: no example target named `cosmic`.
The examples themselves are written as separate crates, and are
therefore not usable as examples (they also won't build via `cargo build
--examples`).
This commit makes the example fit the style that cargo can understand.
That is:
- Don't declare the example as a separate crate.
- Remove the nested `src` inside the example directory.
- Put example-only dependencies in dev-dependencies
No rust code was modified, files were only moved.
43 lines
1.1 KiB
Rust
43 lines
1.1 KiB
Rust
use super::{Page, SubPage};
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum TimeAndLanguagePage {
|
|
DateAndTime,
|
|
RegionAndLanguage,
|
|
}
|
|
|
|
impl SubPage for TimeAndLanguagePage {
|
|
//TODO: translate
|
|
fn title(&self) -> &'static str {
|
|
use TimeAndLanguagePage::*;
|
|
match self {
|
|
DateAndTime => "Date & Time",
|
|
RegionAndLanguage => "Region & Language",
|
|
}
|
|
}
|
|
|
|
//TODO: translate
|
|
fn description(&self) -> &'static str {
|
|
use TimeAndLanguagePage::*;
|
|
match self {
|
|
DateAndTime => "Time zone, automatic clock settings, and some time formatting.",
|
|
RegionAndLanguage => "Format dates, times, and numbers based on your region",
|
|
}
|
|
}
|
|
|
|
fn icon_name(&self) -> &'static str {
|
|
use TimeAndLanguagePage::*;
|
|
match self {
|
|
DateAndTime => "preferences-system-time-symbolic",
|
|
RegionAndLanguage => "preferences-desktop-locale-symbolic",
|
|
}
|
|
}
|
|
|
|
fn parent_page(&self) -> Page {
|
|
Page::TimeAndLanguage(None)
|
|
}
|
|
|
|
fn into_page(self) -> Page {
|
|
Page::TimeAndLanguage(Some(self))
|
|
}
|
|
}
|