Refactor ruin_app, add some README files, minor usability in reactivity
This commit is contained in:
43
lib/ruin_app/src/converters.rs
Normal file
43
lib/ruin_app/src/converters.rs
Normal file
@@ -0,0 +1,43 @@
|
||||
use ruin_ui::{Border, BoxShadow, Color, Edges};
|
||||
|
||||
pub trait IntoEdges {
|
||||
fn into_edges(self) -> Edges;
|
||||
}
|
||||
|
||||
impl IntoEdges for Edges {
|
||||
fn into_edges(self) -> Edges {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoEdges for f32 {
|
||||
fn into_edges(self) -> Edges {
|
||||
Edges::all(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait IntoBorder {
|
||||
fn into_border(self) -> Border;
|
||||
}
|
||||
|
||||
impl IntoBorder for Border {
|
||||
fn into_border(self) -> Border {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoBorder for (f32, Color) {
|
||||
fn into_border(self) -> Border {
|
||||
Border::new(self.0, self.1)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait IntoShadow {
|
||||
fn into_shadow(self) -> BoxShadow;
|
||||
}
|
||||
|
||||
impl IntoShadow for BoxShadow {
|
||||
fn into_shadow(self) -> BoxShadow {
|
||||
self
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user