mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-28 03:12:46 +01:00
refactor(collections): move ring.rs and lockable_sequence.rs into komorebi-collections
Moves the identical ring.rs and lockable_sequence.rs out of komorebi/src into the crate (rename). Necessary edits: lib.rs with pub use Lockable and a hidden pastey re-export; #[macro_export] on impl_ring_elements! using $crate::pastey::paste!; the doc test now says komorebi_collections::ring::Ring. The Windows tree gets the path dependency, re-exports (pub use komorebi_collections::{ring, lockable_sequence, Lockable}, #[macro_use] extern crate), forwards its schemars feature, and drops pastey again. Windows is bundled here because it is the tree the files move out of.
Verified: fast-check native, Windows clippy --all-targets -D warnings, KDE and macOS checks: PASS.
This commit is contained in:
1 parent
11e38c8c8a
commit
4a5733eb1d
7 files changed
+25
-11
No files matched your search
Generated
+2
-1
@@ -3337,6 +3337,7 @@ dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"ed25519-dalek",
|
||||
"hotwatch",
|
||||
"komorebi-collections",
|
||||
"komorebi-layouts",
|
||||
"komorebi-scrolling",
|
||||
"komorebi-themes",
|
||||
@@ -3347,7 +3348,6 @@ dependencies = [
|
||||
"os_info",
|
||||
"parking_lot",
|
||||
"paste",
|
||||
"pastey 0.2.3",
|
||||
"powershell_script",
|
||||
"regex",
|
||||
"reqwest",
|
||||
@@ -3433,6 +3433,7 @@ name = "komorebi-collections"
|
||||
version = "0.1.42"
|
||||
dependencies = [
|
||||
"pastey 0.2.3",
|
||||
"schemars 1.2.3",
|
||||
"serde",
|
||||
"serde_json_lenient",
|
||||
]
|
||||
|
||||
@@ -40,7 +40,6 @@ tracing-appender = "0.2"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
parking_lot = "0.12"
|
||||
paste = "1"
|
||||
pastey = "0.2"
|
||||
sysinfo = "0.39"
|
||||
uds_windows = "1"
|
||||
win32-display-data = { git = "https://github.com/LGUG2Z/win32-display-data", rev = "8c42d8db257d30fe95bc98c2e5cd8f75da861021" }
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//! The collections that every komorebi keeps its monitors, workspaces, containers and windows in.
|
||||
|
||||
pub mod lockable_sequence;
|
||||
pub mod ring;
|
||||
|
||||
pub use lockable_sequence::Lockable;
|
||||
|
||||
// Re-exported so that `impl_ring_elements!` can name `pastey::paste!` from any crate that
|
||||
// calls it, whether or not that crate depends on `pastey` itself.
|
||||
#[doc(hidden)]
|
||||
pub use pastey;
|
||||
File renamed without changes.
@@ -18,7 +18,7 @@ use serde::Serialize;
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use komorebi::ring::Ring;
|
||||
/// use komorebi_collections::ring::Ring;
|
||||
///
|
||||
/// let mut ring = Ring::default();
|
||||
/// ring.elements_mut().push_back("a");
|
||||
@@ -83,9 +83,10 @@ impl<T> Ring<T> {
|
||||
/// `focused_container_idx()` and `focused_container_mut()`. The field is named after the element
|
||||
/// type in lower case with an `s` appended, and the methods after the field, so that "the focused
|
||||
/// container" is spelled the same way on every type that has one.
|
||||
#[macro_export]
|
||||
macro_rules! impl_ring_elements {
|
||||
($name:ty, $element:ident) => {
|
||||
pastey::paste! {
|
||||
$crate::pastey::paste! {
|
||||
impl $name {
|
||||
pub const fn [<$element:lower s>](&self) -> &std::collections::VecDeque<$element> {
|
||||
self.[<$element:lower s>].elements()
|
||||
@@ -116,7 +117,7 @@ macro_rules! impl_ring_elements {
|
||||
// ```
|
||||
// Which allows using the `Window` element but name the functions as `floating_window`
|
||||
($name:ty, $element:ident, $el_name:literal) => {
|
||||
pastey::paste! {
|
||||
$crate::pastey::paste! {
|
||||
impl $name {
|
||||
pub const fn [<$el_name:lower s>](&self) -> &std::collections::VecDeque<$element> {
|
||||
self.[<$el_name:lower s>].elements()
|
||||
+2
-2
@@ -8,6 +8,7 @@ edition = "2024"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
komorebi-collections = { path = "../crates/komorebi-collections" }
|
||||
komorebi-layouts = { path = "../komorebi-layouts", features = ["win32"] }
|
||||
komorebi-scrolling = { path = "../komorebi-scrolling" }
|
||||
komorebi-themes = { path = "../komorebi-themes" }
|
||||
@@ -30,7 +31,6 @@ net2 = "0.2"
|
||||
os_info = "3.10"
|
||||
parking_lot = { workspace = true }
|
||||
paste = { workspace = true }
|
||||
pastey = { workspace = true }
|
||||
powershell_script = "1.0"
|
||||
regex = "1"
|
||||
reqwest = { version = "0.12", features = ["blocking"] }
|
||||
@@ -66,4 +66,4 @@ uuid = { version = "1", features = ["v4"] }
|
||||
[features]
|
||||
default = ["schemars"]
|
||||
deadlock_detection = ["parking_lot/deadlock_detection"]
|
||||
schemars = ["dep:schemars", "komorebi-layouts/schemars"]
|
||||
schemars = ["dep:schemars", "komorebi-collections/schemars", "komorebi-layouts/schemars"]
|
||||
+6
-4
@@ -1,17 +1,19 @@
|
||||
#![warn(clippy::all)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate komorebi_collections;
|
||||
|
||||
pub mod animation;
|
||||
pub mod border_manager;
|
||||
pub mod cloaked;
|
||||
pub mod com;
|
||||
#[macro_use]
|
||||
pub mod ring;
|
||||
pub use komorebi_collections::ring;
|
||||
pub mod container;
|
||||
pub mod core;
|
||||
pub mod focus_manager;
|
||||
pub mod live_resize;
|
||||
pub mod lockable_sequence;
|
||||
pub use lockable_sequence::Lockable;
|
||||
pub use komorebi_collections::lockable_sequence;
|
||||
pub use komorebi_collections::Lockable;
|
||||
pub mod monitor;
|
||||
pub mod monitor_reconciliator;
|
||||
pub mod pan;
|
||||
|
||||
Reference in new issue
Block a user