Make example runnable as example
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.
This commit is contained in:
parent
e3ec7e3b7d
commit
6ce9f4fc7a
12 changed files with 3 additions and 14 deletions
|
|
@ -1,43 +0,0 @@
|
|||
use super::{Page, Window};
|
||||
use cosmic::{
|
||||
iced::widget::{column, text},
|
||||
widget::{list_column, settings, toggler},
|
||||
Element,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum Message {
|
||||
Enable(bool),
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct State {
|
||||
enabled: bool,
|
||||
}
|
||||
|
||||
impl State {
|
||||
pub(super) fn update(&mut self, message: Message) {
|
||||
match message {
|
||||
Message::Enable(value) => self.enabled = value,
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn view<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
||||
settings::view_column(vec![
|
||||
window.page_title(Page::Bluetooth),
|
||||
column!(
|
||||
list_column().add(settings::item(
|
||||
"Bluetooth",
|
||||
toggler(None, self.enabled, Message::Enable)
|
||||
)),
|
||||
text("Now visible as \"TODO\", just kidding")
|
||||
)
|
||||
.spacing(8)
|
||||
.into(),
|
||||
settings::view_section("Devices")
|
||||
.add(settings::item("No devices found", text("")))
|
||||
.into(),
|
||||
])
|
||||
.into()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue