rusty_vision/traits/
rotate.rs1#![allow(dead_code)]
2use crate::error::Error;
3
4pub enum RotationType {
5 Clockwise90,
6 Clockwise180,
7 Clockwise270,
8 Anticlockwise90,
9 Anticlockwise180,
10 Anticlockwise270,
11 Custom(f32),
12}
13
14impl RotationType {
15 pub fn degree(&self) -> f32 {
16 match self {
17 RotationType::Clockwise90 => 90.0,
18 RotationType::Clockwise180 => 180.0,
19 RotationType::Clockwise270 => 270.0,
20 RotationType::Anticlockwise90 => -90.0,
21 RotationType::Anticlockwise180 => -180.0,
22 RotationType::Anticlockwise270 => -270.0,
23 RotationType::Custom(value) => *value,
24 }
25 }
26}
27
28pub trait Rotatable<T> {
29 fn rotate(&mut self, value: T) -> Result<(), Error>;
30}