mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-20 16:43:57 +01:00
This commit introduces the 'notification-schema' command to generate a JSON schema of the Notification struct which gets sent when notifying subscribers of updates.
33 lines
799 B
Rust
33 lines
799 B
Rust
use schemars::JsonSchema;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
use crate::Arrangement;
|
|
use crate::CustomLayout;
|
|
use crate::DefaultLayout;
|
|
use crate::Direction;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
|
|
pub enum Layout {
|
|
Default(DefaultLayout),
|
|
Custom(CustomLayout),
|
|
}
|
|
|
|
impl Layout {
|
|
#[must_use]
|
|
pub fn as_boxed_direction(&self) -> Box<dyn Direction> {
|
|
match self {
|
|
Layout::Default(layout) => Box::new(*layout),
|
|
Layout::Custom(layout) => Box::new(layout.clone()),
|
|
}
|
|
}
|
|
|
|
#[must_use]
|
|
pub fn as_boxed_arrangement(&self) -> Box<dyn Arrangement> {
|
|
match self {
|
|
Layout::Default(layout) => Box::new(*layout),
|
|
Layout::Custom(layout) => Box::new(layout.clone()),
|
|
}
|
|
}
|
|
}
|