Rename iced_sentinel to iced_beacon and refactor its API
This commit is contained in:
parent
aaf396256e
commit
57033dc4d0
19 changed files with 596 additions and 438 deletions
61
beacon/src/span.rs
Normal file
61
beacon/src/span.rs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
use crate::core::window;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub enum Span {
|
||||
Boot,
|
||||
Update,
|
||||
View { window: window::Id },
|
||||
Layout { window: window::Id },
|
||||
Interact { window: window::Id },
|
||||
Draw { window: window::Id },
|
||||
Present { window: window::Id },
|
||||
Custom { window: window::Id, name: String },
|
||||
}
|
||||
|
||||
impl Span {
|
||||
pub fn stage(&self) -> Stage {
|
||||
match self {
|
||||
Span::Boot => Stage::Boot,
|
||||
Span::Update => Stage::Update,
|
||||
Span::View { window } => Stage::View(*window),
|
||||
Span::Layout { window } => Stage::Layout(*window),
|
||||
Span::Interact { window } => Stage::Interact(*window),
|
||||
Span::Draw { window } => Stage::Draw(*window),
|
||||
Span::Present { window } => Stage::Present(*window),
|
||||
Span::Custom { window, name } => {
|
||||
Stage::Custom(*window, name.clone())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize,
|
||||
)]
|
||||
pub enum Stage {
|
||||
Boot,
|
||||
Update,
|
||||
View(window::Id),
|
||||
Layout(window::Id),
|
||||
Interact(window::Id),
|
||||
Draw(window::Id),
|
||||
Present(window::Id),
|
||||
Custom(window::Id, String),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Stage {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(match self {
|
||||
Stage::Boot => "Boot",
|
||||
Stage::Update => "Update",
|
||||
Stage::View(_) => "View",
|
||||
Stage::Layout(_) => "Layout",
|
||||
Stage::Interact(_) => "Interact",
|
||||
Stage::Draw(_) => "Draw",
|
||||
Stage::Present(_) => "Present",
|
||||
Stage::Custom(_, name) => name,
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue