54 lines
1.1 KiB
Rust
54 lines
1.1 KiB
Rust
use std::fmt::Debug;
|
|
|
|
use gpui::Axis;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum Side {
|
|
#[serde(rename = "left")]
|
|
Left,
|
|
#[serde(rename = "right")]
|
|
Right,
|
|
}
|
|
|
|
impl Side {
|
|
#[inline]
|
|
pub fn is_left(&self) -> bool {
|
|
matches!(self, Self::Left)
|
|
}
|
|
|
|
#[inline]
|
|
pub fn is_right(&self) -> bool {
|
|
matches!(self, Self::Right)
|
|
}
|
|
}
|
|
|
|
pub trait AxisExt {
|
|
#[allow(clippy::wrong_self_convention)]
|
|
fn is_horizontal(self) -> bool;
|
|
#[allow(clippy::wrong_self_convention)]
|
|
fn is_vertical(self) -> bool;
|
|
}
|
|
|
|
impl AxisExt for Axis {
|
|
#[inline]
|
|
fn is_horizontal(self) -> bool {
|
|
self == Axis::Horizontal
|
|
}
|
|
|
|
#[inline]
|
|
fn is_vertical(self) -> bool {
|
|
self == Axis::Vertical
|
|
}
|
|
}
|
|
|
|
/// [`gpui::Edges`] with serde support.
|
|
#[derive(Debug, Clone, Default, Serialize, Deserialize, Eq, PartialEq)]
|
|
#[repr(C)]
|
|
pub struct Edges<T: Clone + Debug + Default + PartialEq> {
|
|
pub top: T,
|
|
pub right: T,
|
|
pub bottom: T,
|
|
pub left: T,
|
|
}
|