From 1902df931608eb351b34d48175437c557bc16a03 Mon Sep 17 00:00:00 2001 From: Mikayla Date: Sun, 21 Jan 2024 15:51:33 -0800 Subject: [PATCH] WIP: Start geometry crate --- crates/gpui/src/geometry.rs | 8 ++++++++ crates/gpui/src/gpui.rs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/geometry.rs b/crates/gpui/src/geometry.rs index 0a22611fac8a2bdc38087710e4509cf57feb9e57..ef71f94ef664d381fef8fa54ba72718fdcb5cf99 100644 --- a/crates/gpui/src/geometry.rs +++ b/crates/gpui/src/geometry.rs @@ -1,3 +1,7 @@ +//! The GPUI geometry module is a collection of types and traits that +//! can be used to describe common units, concepts, and the relationships +//! between them. + use core::fmt::Debug; use derive_more::{Add, AddAssign, Div, DivAssign, Mul, Neg, Sub, SubAssign}; use refineable::Refineable; @@ -8,13 +12,17 @@ use std::{ ops::{Add, Div, Mul, MulAssign, Sub}, }; +/// An axis along which a measurement can be made. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum Axis { + /// The y axis, or up and down Vertical, + /// The x axis, or left and right Horizontal, } impl Axis { + /// Swap this axis to the opposite axis. pub fn invert(&self) -> Self { match self { Axis::Vertical => Axis::Horizontal, diff --git a/crates/gpui/src/gpui.rs b/crates/gpui/src/gpui.rs index a64d043ab87e84d1fdf2f9812db205616503ead5..8ecfd8ad6d834ac8c6577e2f724e22719e15e36e 100644 --- a/crates/gpui/src/gpui.rs +++ b/crates/gpui/src/gpui.rs @@ -26,7 +26,7 @@ //! TODO!(docs): Wrap up with a conclusion and links to other places? Zed / GPUI website? //! Discord for chatting about it? Other tutorials or references? -// #![deny(missing_docs)] +#![deny(missing_docs)] #![allow(clippy::type_complexity)] #[macro_use]