Function carboxyl::lift::lift0
+
+ [−]
+
+ [src]
+pub fn lift0<A, F>(f: F) -> Signal<A> where F: Fn() -> A + Send + Sync + 'static
Lift a 0-ary function.
+From 64106c4d3d4ddba8c7bc2af75376e6d3d3d75601 Mon Sep 17 00:00:00 2001 From: Date: Mon, 29 Jun 2015 20:16:15 +0000 Subject: Update documentation --- carboxyl/lift/fn.lift0.html | 102 ++++++++++++++++++++++++ carboxyl/lift/fn.lift1.html | 102 ++++++++++++++++++++++++ carboxyl/lift/fn.lift2.html | 102 ++++++++++++++++++++++++ carboxyl/lift/fn.lift3.html | 102 ++++++++++++++++++++++++ carboxyl/lift/fn.lift4.html | 102 ++++++++++++++++++++++++ carboxyl/lift/index.html | 173 +++++++++++++++++++++++++++++++++++++++++ carboxyl/lift/sidebar-items.js | 1 + 7 files changed, 684 insertions(+) create mode 100644 carboxyl/lift/fn.lift0.html create mode 100644 carboxyl/lift/fn.lift1.html create mode 100644 carboxyl/lift/fn.lift2.html create mode 100644 carboxyl/lift/fn.lift3.html create mode 100644 carboxyl/lift/fn.lift4.html create mode 100644 carboxyl/lift/index.html create mode 100644 carboxyl/lift/sidebar-items.js (limited to 'carboxyl/lift') diff --git a/carboxyl/lift/fn.lift0.html b/carboxyl/lift/fn.lift0.html new file mode 100644 index 0000000..f7fd88e --- /dev/null +++ b/carboxyl/lift/fn.lift0.html @@ -0,0 +1,102 @@ + + +
+ + + + + + +pub fn lift0<A, F>(f: F) -> Signal<A> where F: Fn() -> A + Send + Sync + 'static
Lift a 0-ary function.
+
+ Prefix searches with a type followed by a colon (e.g.
+ fn:
) to restrict the search to a given type.
+
+ Accepted types are: fn
, mod
,
+ struct
, enum
,
+ trait
, typedef
(or
+ tdef
).
+
+ Search functions by type signature (e.g.
+ vec -> usize
)
+
pub fn lift1<A, B, F>(f: F, sa: &Signal<A>) -> Signal<B> where A: Send + Sync + Clone + 'static, B: Send + Sync + Clone + 'static, F: Fn(A) -> B + Send + Sync + 'static
Lift a unary function.
+
+ Prefix searches with a type followed by a colon (e.g.
+ fn:
) to restrict the search to a given type.
+
+ Accepted types are: fn
, mod
,
+ struct
, enum
,
+ trait
, typedef
(or
+ tdef
).
+
+ Search functions by type signature (e.g.
+ vec -> usize
)
+
pub fn lift2<A, B, C, F>(f: F, sa: &Signal<A>, sb: &Signal<B>) -> Signal<C> where A: Send + Sync + Clone + 'static, B: Send + Sync + Clone + 'static, C: Send + Sync + Clone + 'static, F: Fn(A, B) -> C + Send + Sync + 'static
Lift a binary function.
+
+ Prefix searches with a type followed by a colon (e.g.
+ fn:
) to restrict the search to a given type.
+
+ Accepted types are: fn
, mod
,
+ struct
, enum
,
+ trait
, typedef
(or
+ tdef
).
+
+ Search functions by type signature (e.g.
+ vec -> usize
)
+
pub fn lift3<F, A, B, C, Ret>(f: F, ca: &Signal<A>, cb: &Signal<B>, cc: &Signal<C>) -> Signal<Ret> where F: Fn(A, B, C) -> Ret + Send + Sync + 'static, A: Send + Sync + Clone + 'static, B: Send + Sync + Clone + 'static, C: Send + Sync + Clone + 'static, Ret: Send + Sync + Clone + 'static
Lift a ternary function.
+
+ Prefix searches with a type followed by a colon (e.g.
+ fn:
) to restrict the search to a given type.
+
+ Accepted types are: fn
, mod
,
+ struct
, enum
,
+ trait
, typedef
(or
+ tdef
).
+
+ Search functions by type signature (e.g.
+ vec -> usize
)
+
pub fn lift4<F, A, B, C, D, Ret>(f: F, ca: &Signal<A>, cb: &Signal<B>, cc: &Signal<C>, cd: &Signal<D>) -> Signal<Ret> where F: Fn(A, B, C, D) -> Ret + Send + Sync + 'static, A: Send + Sync + Clone + 'static, B: Send + Sync + Clone + 'static, C: Send + Sync + Clone + 'static, D: Send + Sync + Clone + 'static, Ret: Send + Sync + Clone + 'static
Lift a quarternary function.
+
+ Prefix searches with a type followed by a colon (e.g.
+ fn:
) to restrict the search to a given type.
+
+ Accepted types are: fn
, mod
,
+ struct
, enum
,
+ trait
, typedef
(or
+ tdef
).
+
+ Search functions by type signature (e.g.
+ vec -> usize
)
+
Lifting of n-ary functions.
+ +A lift maps a function on values to a function on signals. Given a function of
+type F: Fn(A, B, …) -> R
and signals of types Signal<A>, Signal<B>, …
the
+lift!
macro creates a Signal<R>
, whose content is computed using the
+function.
Currently lift is only implemented for functions with up to four arguments. +This limitation is due to the current implementation strategy (and maybe +limitations of Rust's type system), but it can be increased to arbitrary but +finite arity if required.
+ ++let sink_a = Sink::new(); +let sink_b = Sink::new(); +let product = lift!( + |a, b| a * b, + &sink_a.stream().hold(0), + &sink_b.stream().hold(0) +); +assert_eq!(product.sample(), 0); +sink_a.send(3); +sink_b.send(5); +assert_eq!(product.sample(), 15); ++
lift0 | +
+ Lift a 0-ary function. + + |
+
lift1 | +
+ Lift a unary function. + + |
+
lift2 | +
+ Lift a binary function. + + |
+
lift3 | +
+ Lift a ternary function. + + |
+
lift4 | +
+ Lift a quarternary function. + + |
+
+ Prefix searches with a type followed by a colon (e.g.
+ fn:
) to restrict the search to a given type.
+
+ Accepted types are: fn
, mod
,
+ struct
, enum
,
+ trait
, typedef
(or
+ tdef
).
+
+ Search functions by type signature (e.g.
+ vec -> usize
)
+