Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace optional values with defaults when unset #21

Merged
merged 2 commits into from
Jun 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions leftwm-layouts/src/layouts/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type LayoutName = String;
/// The [`Layout`] allows to describe various types of "fixed" layouts used by a dynamic tiling manager.
/// Those include layouts like `MainAndStack`, `Fibonacci`, `Dwindle`, `CenterMain`, etc.
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
#[serde(default)]
pub struct Layout {
/// Name and identifier of the layout.
/// This is user chosen and no two layouts can have the same name.
Expand Down Expand Up @@ -320,6 +321,7 @@ impl Default for Layout {
/// in a `MainAndStack` layout configuration, the [`Flip`] property could be set to [`Flip::Vertical`],
/// which results in the columns being flipped, **but not their contents**.
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
#[serde(default)]
pub struct Columns {
/// How the columns should be flipped, does not apply to their contents
pub flip: Flip,
Expand Down Expand Up @@ -364,6 +366,7 @@ impl Default for Columns {

/// Configurations concerning the `main` column
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
#[serde(default)]
pub struct Main {
/// The default amount of windows to occupy the `main` column (default: `1`)
pub count: usize,
Expand Down Expand Up @@ -399,6 +402,7 @@ impl Default for Main {

/// Configurations concerning the `stack` column
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
#[serde(default)]
pub struct Stack {
/// Flip modifier to apply only to the `stack` columns' contents
pub flip: Flip,
Expand Down Expand Up @@ -426,6 +430,7 @@ impl Default for Stack {

/// Configurations concerning the `second_stack` column
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
#[serde(default)]
pub struct SecondStack {
/// Flip modifier to apply only to the `second_stack` columns' contents
pub flip: Flip,
Expand Down