use std::fmt;
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub enum PaneSize {
Size(usize),
Percentage(usize),
}
#[cfg(feature = "tmux_3_2")]
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub enum Size {
Size(usize),
Percentage(usize),
}
#[cfg(feature = "tmux_3_2")]
impl fmt::Display for Size {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let s = match self {
Size::Size(size) => size.to_string(),
Size::Percentage(size) => {
format!("{}%", size)
}
};
write!(f, "{}", s)
}
}
impl fmt::Display for PaneSize {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
#[cfg(all(feature = "tmux_0_8", not(feature = "tmux_3_1")))]
let s = match self {
PaneSize::Size(size) => size.to_string(),
PaneSize::Percentage(size) => {
format!("{}%", size)
}
};
#[cfg(feature = "tmux_3_1")]
let s = match self {
PaneSize::Size(size) => size.to_string(),
PaneSize::Percentage(size) => size.to_string(),
};
write!(f, "{}", s)
}
}