diff --git a/komorebi/src/lib.rs b/komorebi/src/lib.rs index 4149a2f3..fd14e174 100644 --- a/komorebi/src/lib.rs +++ b/komorebi/src/lib.rs @@ -11,6 +11,7 @@ pub mod core; pub mod focus_manager; pub mod live_resize; pub mod lockable_sequence; +pub use lockable_sequence::Lockable; pub mod monitor; pub mod monitor_reconciliator; pub mod pan; @@ -280,14 +281,6 @@ pub struct License { pub signature: String, } -/// A trait for types that can be marked as locked or unlocked. -pub trait Lockable { - /// Returns `true` if the item is locked. - fn locked(&self) -> bool; - /// Sets the locked state of the item. - fn set_locked(&mut self, locked: bool) -> &mut Self; -} - #[must_use] pub fn current_virtual_desktop() -> Option> { let hkcu = RegKey::predef(HKEY_CURRENT_USER); diff --git a/komorebi/src/lockable_sequence.rs b/komorebi/src/lockable_sequence.rs index b895d697..421eb22d 100644 --- a/komorebi/src/lockable_sequence.rs +++ b/komorebi/src/lockable_sequence.rs @@ -1,6 +1,17 @@ +//! Lists in which some elements are locked in place. +//! +//! A locked container keeps its position in the layout when others are inserted, removed or +//! swapped around it. [`LockableSequence`] does that bookkeeping for a [`VecDeque`]. + use std::collections::VecDeque; -use crate::Lockable; +/// A trait for types that can be marked as locked or unlocked. +pub trait Lockable { + /// Returns `true` if the item is locked. + fn locked(&self) -> bool; + /// Sets the locked state of the item. + fn set_locked(&mut self, locked: bool) -> &mut Self; +} /// A sequence supporting insertion, removal, and swapping of elements while preserving the absolute /// positions of locked items.