Skip to content
This repository was archived by the owner on Oct 10, 2019. It is now read-only.

Commit 6b8975e

Browse files
committed
Add rustfmt
Signed-off-by: Sascha Grunert <[email protected]>
1 parent c083b1d commit 6b8975e

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

examples/minimal.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![recursion_limit = "256"]
22

3-
use yew::{html, Bridge, Bridged, Component, ComponentLink, Html, Renderable, ShouldRender};
3+
use yew::{
4+
html, Bridge, Bridged, Component, ComponentLink, Html, Renderable,
5+
ShouldRender,
6+
};
47
use yew_router::{routes, Route, RouterAgent};
58

69
// Define application routes via the macro
@@ -37,7 +40,8 @@ impl Component for RootComponent {
3740
fn create(_: Self::Properties, mut link: ComponentLink<Self>) -> Self {
3841
// Connect to the router agent using Yew's bridge method for workers
3942
// Send back the method we will be using to route the user
40-
let router_agent = RouterAgent::bridge(link.send_back(PageActions::Route));
43+
let router_agent =
44+
RouterAgent::bridge(link.send_back(PageActions::Route));
4145

4246
RootComponent {
4347
child_component: RouterTarget::Login,

src/router.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ use std::{collections::HashSet, fmt::Debug, marker::PhantomData};
44
use stdweb::{
55
js,
66
unstable::TryFrom,
7-
web::{event::PopStateEvent, window, EventListenerHandle, History, IEventTarget, Location},
7+
web::{
8+
event::PopStateEvent, window, EventListenerHandle, History,
9+
IEventTarget, Location,
10+
},
811
JsSerialize, Value,
912
};
1013
use yew::{callback::Callback, prelude::worker::*};
@@ -42,7 +45,9 @@ where
4245
/// of its stack when the forward or back buttons are pressed.
4346
pub fn register_callback(&mut self, callback: Callback<()>) {
4447
self.event_listener =
45-
Some(window().add_event_listener(move |_event: PopStateEvent| callback.emit(())));
48+
Some(window().add_event_listener(move |_event: PopStateEvent| {
49+
callback.emit(())
50+
}));
4651
}
4752

4853
/// Sets the browser's url bar to contain the provided route, and creates a
@@ -140,7 +145,8 @@ where
140145
pub fn current_route(route_service: &RouterService<T>) -> Fallible<Self> {
141146
// guaranteed to always start with a '/'
142147
let path = route_service.get_path()?;
143-
let mut path_segments: Vec<String> = path.split('/').map(String::from).collect();
148+
let mut path_segments: Vec<String> =
149+
path.split('/').map(String::from).collect();
144150
// remove empty string that is split from the first '/'
145151
path_segments.remove(0);
146152

@@ -188,7 +194,10 @@ pub enum Request<T> {
188194
GetCurrentRoute,
189195
}
190196

191-
impl<T> Transferable for Request<T> where for<'de> T: Serialize + Deserialize<'de> {}
197+
impl<T> Transferable for Request<T> where
198+
for<'de> T: Serialize + Deserialize<'de>
199+
{
200+
}
192201

193202
/// The RouterAgent worker holds on to the RouterService singleton and mediates
194203
/// access to it.

0 commit comments

Comments
 (0)