Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Oct 15, 2023
1 parent ac2a9c0 commit 5e51bbd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
26 changes: 11 additions & 15 deletions examples/clipboard/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,24 @@ fn app(cx: Scope) -> Element {
let clipboard = use_clipboard(cx);
let text = use_state(cx, String::new);

let oninput = |e: FormEvent | {
let oninput = |e: FormEvent| {
text.set(e.data.value.clone());
};

let oncopy = {
to_owned![clipboard];
move |_| {
match clipboard.set(text.get().clone()) {
Ok(_) => println!("Copied to clipboard: {}", text.get()),
Err(err) => println!("Error on copy: {err:?}")
}
move |_| match clipboard.set(text.get().clone()) {
Ok(_) => println!("Copied to clipboard: {}", text.get()),
Err(err) => println!("Error on copy: {err:?}"),
}
};

let onpaste = move |_| {
match clipboard.get() {
Ok(contents) => {
println!("Pasted from clipboard: {contents}");
text.set(contents);
},
Err(err) => println!("Error on paste: {err:?}")
let onpaste = move |_| match clipboard.get() {
Ok(contents) => {
println!("Pasted from clipboard: {contents}");
text.set(contents);
}
Err(err) => println!("Error on paste: {err:?}"),
};

render!(
Expand All @@ -40,11 +36,11 @@ fn app(cx: Scope) -> Element {
value: "{text}"
}
button {
onclick: oncopy,
onclick: oncopy,
"Copy"
}
button {
onclick: onpaste,
onclick: onpaste,
"Paste"
}
)
Expand Down
6 changes: 2 additions & 4 deletions examples/geolocation/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use dioxus::prelude::*;
use dioxus_std::geolocation::{
init_geolocator, use_geolocation, PowerMode
};
use dioxus_std::geolocation::{init_geolocator, use_geolocation, PowerMode};

fn main() {
dioxus_desktop::launch(app);
Expand Down Expand Up @@ -34,7 +32,7 @@ fn app(cx: Scope) -> Element {
h1 { "🗺️ Dioxus Geolocation Example 🛰️" }
h3 { "Your initial location is:"}

p {
p {
if let Some(coords) = initial_coords {
format!("Latitude: {} | Longitude: {}", coords.latitude, coords.longitude)
} else {
Expand Down

0 comments on commit 5e51bbd

Please sign in to comment.