leptos_use/core/
direction.rs1#[derive(Copy, Clone, Eq, PartialEq, Debug)]
3pub enum Direction {
4 Top,
5 Bottom,
6 Left,
7 Right,
8}
9
10#[derive(Copy, Clone, Default, Debug)]
11pub struct Directions {
13 pub left: bool,
14 pub right: bool,
15 pub top: bool,
16 pub bottom: bool,
17}
18
19impl Directions {
20 pub fn get_direction(&self, direction: Direction) -> bool {
22 match direction {
23 Direction::Top => self.top,
24 Direction::Bottom => self.bottom,
25 Direction::Left => self.left,
26 Direction::Right => self.right,
27 }
28 }
29
30 pub fn set_direction(mut self, direction: Direction, value: bool) -> Self {
32 match direction {
33 Direction::Top => self.top = value,
34 Direction::Bottom => self.bottom = value,
35 Direction::Left => self.left = value,
36 Direction::Right => self.right = value,
37 }
38
39 self
40 }
41}