mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-31 22:43:16 +02:00
This commit introduce state snapshot checks in the border manager, which will ensure that we don't even attempt to acquire any mutex locks if the state hasn't changed.
33 lines
810 B
Rust
33 lines
810 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, PartialEq)]
|
|
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()),
|
|
}
|
|
}
|
|
}
|