delta-gitu 0.1.11

An experimental fork of gitu (a git client inspired by Magit), published as a library for delta to embed
Documentation
use super::vec2::{Scalar, Vec2};

#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Direction {
    Horizontal,
    Vertical,
}

impl Direction {
    /// The unit vector along this direction, used to mask a `Vec2` down to one
    /// axis.
    pub(crate) fn axis<U: Scalar>(&self) -> Vec2<U> {
        match self {
            Direction::Horizontal => Vec2(U::ONE, U::ZERO),
            Direction::Vertical => Vec2(U::ZERO, U::ONE),
        }
    }

    pub(crate) fn flip(&self) -> Self {
        match self {
            Direction::Horizontal => Direction::Vertical,
            Direction::Vertical => Direction::Horizontal,
        }
    }
}