Skip to content

Commit 8692386

Browse files
committed
format
1 parent b7fbb15 commit 8692386

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

src/view.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::*;
2-
use std::any::{Any, TypeId};
32
use dyn_clone::DynClone;
3+
use std::any::{Any, TypeId};
44

55
pub struct DrawArgs<'a> {
66
pub cx: &'a mut Context,
@@ -88,4 +88,4 @@ pub trait DynView: private::Sealed + DynClone + 'static {
8888
/// Trait for the unit of UI composition.
8989
pub trait View: DynView + Clone {}
9090

91-
impl<V: DynView + Clone> View for V {}
91+
impl<V: DynView + Clone> View for V {}

src/views/list.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,23 +240,32 @@ impl<ID, F> private::Sealed for List<ID, F> {}
240240
/// ))
241241
/// }));
242242
/// ```
243-
pub fn list<ID: Hash + Clone, V: View, F: Fn(&ID) -> V + Clone + 'static>(ids: Vec<ID>, f: F) -> List<ID, F> {
243+
pub fn list<ID: Hash + Clone, V: View, F: Fn(&ID) -> V + Clone + 'static>(
244+
ids: Vec<ID>,
245+
f: F,
246+
) -> List<ID, F> {
244247
List {
245248
orientation: ListOrientation::Vertical,
246249
ids,
247250
func: f,
248251
}
249252
}
250253

251-
pub fn hlist<ID: Hash + Clone, V: View, F: Fn(&ID) -> V + Clone + 'static>(ids: Vec<ID>, f: F) -> List<ID, F> {
254+
pub fn hlist<ID: Hash + Clone, V: View, F: Fn(&ID) -> V + Clone + 'static>(
255+
ids: Vec<ID>,
256+
f: F,
257+
) -> List<ID, F> {
252258
List {
253259
orientation: ListOrientation::Horizontal,
254260
ids,
255261
func: f,
256262
}
257263
}
258264

259-
pub fn zlist<ID: Hash + Clone, V: View, F: Fn(&ID) -> V + Clone + 'static>(ids: Vec<ID>, f: F) -> List<ID, F> {
265+
pub fn zlist<ID: Hash + Clone, V: View, F: Fn(&ID) -> V + Clone + 'static>(
266+
ids: Vec<ID>,
267+
f: F,
268+
) -> List<ID, F> {
260269
List {
261270
orientation: ListOrientation::Z,
262271
ids,

src/views/modview.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ where
8585
}
8686

8787
/// Passes a value to a function. Value can be updated by modifiers.
88-
pub fn modview<S: Clone + Default + 'static, V: View, F: Fn(S, &mut Context) -> V + Clone + 'static>(
88+
pub fn modview<
89+
S: Clone + Default + 'static,
90+
V: View,
91+
F: Fn(S, &mut Context) -> V + Clone + 'static,
92+
>(
8993
f: F,
9094
) -> ModView<S, F> {
9195
ModView {

src/views/stack.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,16 +337,16 @@ impl<VT: ViewTuple, D: StackDirection> Stack<VT, D> {
337337
impl<VT, D> private::Sealed for Stack<VT, D> {}
338338

339339
/// Horizontal stack of up to 128 Views in a tuple. Each item can be a different view type.
340-
pub fn hstack<VT: ViewTuple + 'static>(children: VT) -> Stack::<VT, HorizontalDirection> {
340+
pub fn hstack<VT: ViewTuple + 'static>(children: VT) -> Stack<VT, HorizontalDirection> {
341341
Stack::<VT, HorizontalDirection>::new(children)
342342
}
343343

344344
/// Vertical stack of up to 128 Views in a tuple. Each item can be a different view type.
345-
pub fn vstack<VT: ViewTuple + 'static>(children: VT) -> Stack::<VT, VerticalDirection> {
345+
pub fn vstack<VT: ViewTuple + 'static>(children: VT) -> Stack<VT, VerticalDirection> {
346346
Stack::<VT, VerticalDirection>::new(children)
347347
}
348348

349349
/// Stack of up to 128 overlaid Views in a tuple. Each item can be a different view type.
350-
pub fn zstack<VT: ViewTuple + 'static>(children: VT) -> Stack::<VT, ZDirection> {
350+
pub fn zstack<VT: ViewTuple + 'static>(children: VT) -> Stack<VT, ZDirection> {
351351
Stack::<VT, ZDirection>::new(children)
352352
}

src/views/state.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ pub fn with_cx<V: View, F: Fn(&Context) -> V + Clone + 'static>(f: F) -> impl Vi
223223
}
224224

225225
/// Convenience to retreive a reference to a value in the context.
226-
pub fn with_ref<V: View, F: Fn(&T) -> V + Clone + 'static, T>(binding: impl Binding<T>, f: F) -> impl View {
226+
pub fn with_ref<V: View, F: Fn(&T) -> V + Clone + 'static, T>(
227+
binding: impl Binding<T>,
228+
f: F,
229+
) -> impl View {
227230
with_cx(move |cx| f(binding.get(cx)))
228231
}

0 commit comments

Comments
 (0)