floating_ui/floating_ui/utils/
padding.rs1use super::PartialSideObject;
2
3pub enum Padding {
4 Number(f64),
5 PartialSideObject(PartialSideObject),
6}
7
8impl From<f64> for Padding {
9 fn from(child: f64) -> Self {
10 Self::Number(child)
11 }
12}
13
14impl TryInto<f64> for Padding {
15 type Error = ();
16
17 fn try_into(self) -> Result<f64, Self::Error> {
18 match self {
19 Self::Number(value) => Ok(value),
20 _ => Err(()),
21 }
22 }
23}
24
25impl From<PartialSideObject> for Padding {
26 fn from(child: PartialSideObject) -> Self {
27 Self::PartialSideObject(child)
28 }
29}
30
31impl TryInto<PartialSideObject> for Padding {
32 type Error = ();
33
34 fn try_into(self) -> Result<PartialSideObject, Self::Error> {
35 match self {
36 Self::PartialSideObject(value) => Ok(value),
37 _ => Err(()),
38 }
39 }
40}
41
42