chore: run cargo fmt
This commit is contained in:
parent
5d6ab1fa71
commit
63c13e1739
@ -1,9 +1,9 @@
|
|||||||
use crate::components::BackgroundProps;
|
|
||||||
use crate::components::Background;
|
use crate::components::Background;
|
||||||
use crate::routes::whymdc::*;
|
use crate::components::BackgroundProps;
|
||||||
use crate::routes::home::*;
|
|
||||||
use crate::routes::empty::*;
|
|
||||||
use crate::routes::blog::*;
|
use crate::routes::blog::*;
|
||||||
|
use crate::routes::empty::*;
|
||||||
|
use crate::routes::home::*;
|
||||||
|
use crate::routes::whymdc::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_meta::*;
|
use leptos_meta::*;
|
||||||
use leptos_router::*;
|
use leptos_router::*;
|
||||||
@ -44,4 +44,3 @@ pub fn App(cx: Scope) -> impl IntoView {
|
|||||||
</Router>
|
</Router>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,11 @@ pub fn Background(cx: Scope, class: &'static str) -> impl IntoView {
|
|||||||
context_to_render.move_to(n.position.x.into(), n.position.y.into());
|
context_to_render.move_to(n.position.x.into(), n.position.y.into());
|
||||||
context_to_render.line_to(child.position.x.into(), child.position.y.into());
|
context_to_render.line_to(child.position.x.into(), child.position.y.into());
|
||||||
};
|
};
|
||||||
let mut sc = SpaceColonization::new(width.try_into().unwrap(), height.try_into().unwrap(), render_node_fn);
|
let mut sc = SpaceColonization::new(
|
||||||
|
width.try_into().unwrap(),
|
||||||
|
height.try_into().unwrap(),
|
||||||
|
render_node_fn,
|
||||||
|
);
|
||||||
let nodes = Rc::new(RefCell::new(Vec::new()));
|
let nodes = Rc::new(RefCell::new(Vec::new()));
|
||||||
nodes.borrow_mut().push(Node::new(Point::new((
|
nodes.borrow_mut().push(Node::new(Point::new((
|
||||||
(window_width / 3) as i32,
|
(window_width / 3) as i32,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
mod codeblock;
|
|
||||||
mod code;
|
|
||||||
mod background;
|
mod background;
|
||||||
pub use codeblock::*;
|
mod code;
|
||||||
pub use code::*;
|
mod codeblock;
|
||||||
pub use background::*;
|
pub use background::*;
|
||||||
|
pub use code::*;
|
||||||
|
pub use codeblock::*;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
mod space_colonization;
|
|
||||||
pub mod app;
|
pub mod app;
|
||||||
mod components;
|
mod components;
|
||||||
mod routes;
|
mod routes;
|
||||||
|
mod space_colonization;
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
use crate::components::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_meta::*;
|
use leptos_meta::*;
|
||||||
use crate::components::*;
|
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Blog(cx: Scope) -> impl IntoView {
|
pub fn Blog(cx: Scope) -> impl IntoView {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pub mod whymdc;
|
|
||||||
pub mod home;
|
|
||||||
pub mod blog;
|
pub mod blog;
|
||||||
pub mod empty;
|
pub mod empty;
|
||||||
|
pub mod home;
|
||||||
|
pub mod whymdc;
|
||||||
|
|||||||
@ -31,5 +31,3 @@ pub fn SubsectionTitle(cx: Scope, dark: bool, children: Children) -> impl IntoVi
|
|||||||
<h5 class={class}>{children(cx)}</h5>
|
<h5 class={class}>{children(cx)}</h5>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -69,24 +69,15 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn distance_to_itself_is_zero() {
|
fn distance_to_itself_is_zero() {
|
||||||
let p = Point {
|
let p = Point { x: 1, y: 1 };
|
||||||
x: 1,
|
|
||||||
y: 1,
|
|
||||||
};
|
|
||||||
assert_eq!(p.distance(&p), 0.0);
|
assert_eq!(p.distance(&p), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn distance_same_x_is_y() {
|
fn distance_same_x_is_y() {
|
||||||
let p1 = Point {
|
let p1 = Point { x: 1, y: 1 };
|
||||||
x: 1,
|
|
||||||
y: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
let p2 = Point {
|
let p2 = Point { x: 1, y: 5 };
|
||||||
x: 1,
|
|
||||||
y: 5,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert_eq!(p1.distance(&p2), 4.0);
|
assert_eq!(p1.distance(&p2), 4.0);
|
||||||
}
|
}
|
||||||
@ -122,60 +113,36 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn distance_quadrant3() {
|
fn distance_quadrant3() {
|
||||||
let p1 = Point {
|
let p1 = Point { x: 3, y: 4 };
|
||||||
x: 3,
|
|
||||||
y: 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
let p2 = Point {
|
let p2 = Point { x: 0, y: 0 };
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert_eq!(p1.distance(&p2), 5.0);
|
assert_eq!(p1.distance(&p2), 5.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn distance_quadrant2() {
|
fn distance_quadrant2() {
|
||||||
let p1 = Point {
|
let p1 = Point { x: 3, y: 4 };
|
||||||
x: 3,
|
|
||||||
y: 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
let p2 = Point {
|
let p2 = Point { x: 0, y: 100 };
|
||||||
x: 0,
|
|
||||||
y: 100,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert_eq!(p1.distance(&p2) as f32, 96.04687);
|
assert_eq!(p1.distance(&p2) as f32, 96.04687);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn distance_quadrant2_fast() {
|
fn distance_quadrant2_fast() {
|
||||||
let p1 = Point {
|
let p1 = Point { x: 3, y: 4 };
|
||||||
x: 3,
|
|
||||||
y: 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
let p2 = Point {
|
let p2 = Point { x: 3, y: 50 };
|
||||||
x: 3,
|
|
||||||
y: 50,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert_eq!(p1.distance(&p2), 46.0);
|
assert_eq!(p1.distance(&p2), 46.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn distance_quadrant4() {
|
fn distance_quadrant4() {
|
||||||
let p1 = Point {
|
let p1 = Point { x: 3, y: 4 };
|
||||||
x: 3,
|
|
||||||
y: 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
let p2 = Point {
|
let p2 = Point { x: 50, y: -50 };
|
||||||
x: 50,
|
|
||||||
y: -50,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert_eq!(p1.distance(&p2) as f32, 71.5891);
|
assert_eq!(p1.distance(&p2) as f32, 71.5891);
|
||||||
}
|
}
|
||||||
@ -234,4 +201,3 @@ mod tests {
|
|||||||
assert_eq!(root.movement(node, 5), Point::new((10, 45)));
|
assert_eq!(root.movement(node, 5), Point::new((10, 45)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -154,8 +154,10 @@ mod test {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
index.get_surrounding_elements(&Point::new((50, 50))).sort(),
|
index.get_surrounding_elements(&Point::new((50, 50))).sort(),
|
||||||
vec![
|
vec![
|
||||||
&4040, &4545, &5040, &6040, &4050, &5050, &6050, &5050, &5151, &6060, &4060, &5060, &6060,
|
&4040, &4545, &5040, &6040, &4050, &5050, &6050, &5050, &5151, &6060, &4060, &5060,
|
||||||
].sort()
|
&6060,
|
||||||
|
]
|
||||||
|
.sort()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user