diff options
Diffstat (limited to 'carboxyl/lift/index.html')
-rw-r--r-- | carboxyl/lift/index.html | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/carboxyl/lift/index.html b/carboxyl/lift/index.html new file mode 100644 index 0000000..57f4038 --- /dev/null +++ b/carboxyl/lift/index.html @@ -0,0 +1,173 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="generator" content="rustdoc"> + <meta name="description" content="API documentation for the Rust `lift` mod in crate `carboxyl`."> + <meta name="keywords" content="rust, rustlang, rust-lang, lift"> + + <title>carboxyl::lift - Rust</title> + + <link rel="stylesheet" type="text/css" href="../../main.css"> + + + +</head> +<body class="rustdoc"> + <!--[if lte IE 8]> + <div class="warning"> + This old browser is unsupported and will most likely display funky + things. + </div> + <![endif]--> + + + + <section class="sidebar"> + + <p class='location'><a href='../index.html'>carboxyl</a></p><script>window.sidebarCurrent = {name: 'lift', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script> + </section> + + <nav class="sub"> + <form class="search-form js-only"> + <div class="search-container"> + <input class="search-input" name="search" + autocomplete="off" + placeholder="Click or press 'S' to search, '?' for more options..." + type="search"> + </div> + </form> + </nav> + + <section id='main' class="content mod"> +<h1 class='fqn'><span class='in-band'>Module <a href='../index.html'>carboxyl</a>::<wbr><a class='mod' href=''>lift</a></span><span class='out-of-band'><span id='render-detail'> + <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> + [<span class='inner'>−</span>] + </a> + </span><a id='src-3641' class='srclink' href='../../src/carboxyl/lift.rs.html#1-254' title='goto source code'>[src]</a></span></h1> +<div class='docblock'><p>Lifting of n-ary functions.</p> + +<p>A lift maps a function on values to a function on signals. Given a function of +type <code>F: Fn(A, B, …) -> R</code> and signals of types <code>Signal<A>, Signal<B>, …</code> the +<code>lift!</code> macro creates a <code>Signal<R></code>, whose content is computed using the +function.</p> + +<p>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.</p> + +<h1 id="example" class='section-header'><a + href="#example">Example</a></h1><pre class='rust rust-example-rendered'> +<span class='kw'>let</span> <span class='ident'>sink_a</span> <span class='op'>=</span> <span class='ident'>Sink</span>::<span class='ident'>new</span>(); +<span class='kw'>let</span> <span class='ident'>sink_b</span> <span class='op'>=</span> <span class='ident'>Sink</span>::<span class='ident'>new</span>(); +<span class='kw'>let</span> <span class='ident'>product</span> <span class='op'>=</span> <span class='macro'>lift</span><span class='macro'>!</span>( + <span class='op'>|</span><span class='ident'>a</span>, <span class='ident'>b</span><span class='op'>|</span> <span class='ident'>a</span> <span class='op'>*</span> <span class='ident'>b</span>, + <span class='kw-2'>&</span><span class='ident'>sink_a</span>.<span class='ident'>stream</span>().<span class='ident'>hold</span>(<span class='number'>0</span>), + <span class='kw-2'>&</span><span class='ident'>sink_b</span>.<span class='ident'>stream</span>().<span class='ident'>hold</span>(<span class='number'>0</span>) +); +<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>product</span>.<span class='ident'>sample</span>(), <span class='number'>0</span>); +<span class='ident'>sink_a</span>.<span class='ident'>send</span>(<span class='number'>3</span>); +<span class='ident'>sink_b</span>.<span class='ident'>send</span>(<span class='number'>5</span>); +<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>product</span>.<span class='ident'>sample</span>(), <span class='number'>15</span>); +</pre> +</div><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2> +<table> + <tr class=' module-item'> + <td><a class='fn' href='fn.lift0.html' + title='carboxyl::lift::lift0'>lift0</a></td> + <td class='docblock short'> + <p>Lift a 0-ary function.</p> + + </td> + </tr> + + <tr class=' module-item'> + <td><a class='fn' href='fn.lift1.html' + title='carboxyl::lift::lift1'>lift1</a></td> + <td class='docblock short'> + <p>Lift a unary function.</p> + + </td> + </tr> + + <tr class=' module-item'> + <td><a class='fn' href='fn.lift2.html' + title='carboxyl::lift::lift2'>lift2</a></td> + <td class='docblock short'> + <p>Lift a binary function.</p> + + </td> + </tr> + + <tr class=' module-item'> + <td><a class='fn' href='fn.lift3.html' + title='carboxyl::lift::lift3'>lift3</a></td> + <td class='docblock short'> + <p>Lift a ternary function.</p> + + </td> + </tr> + + <tr class=' module-item'> + <td><a class='fn' href='fn.lift4.html' + title='carboxyl::lift::lift4'>lift4</a></td> + <td class='docblock short'> + <p>Lift a quarternary function.</p> + + </td> + </tr> + </table></section> + <section id='search' class="content hidden"></section> + + <section class="footer"></section> + + <div id="help" class="hidden"> + <div class="shortcuts"> + <h1>Keyboard shortcuts</h1> + <dl> + <dt>?</dt> + <dd>Show this help dialog</dd> + <dt>S</dt> + <dd>Focus the search field</dd> + <dt>⇤</dt> + <dd>Move up in search results</dd> + <dt>⇥</dt> + <dd>Move down in search results</dd> + <dt>⏎</dt> + <dd>Go to active search result</dd> + </dl> + </div> + <div class="infos"> + <h1>Search tricks</h1> + <p> + Prefix searches with a type followed by a colon (e.g. + <code>fn:</code>) to restrict the search to a given type. + </p> + <p> + Accepted types are: <code>fn</code>, <code>mod</code>, + <code>struct</code>, <code>enum</code>, + <code>trait</code>, <code>typedef</code> (or + <code>tdef</code>). + </p> + <p> + Search functions by type signature (e.g. + <code>vec -> usize</code>) + </p> + </div> + </div> + + + + <script> + window.rootPath = "../../"; + window.currentCrate = "carboxyl"; + window.playgroundUrl = ""; + </script> + <script src="../../jquery.js"></script> + <script src="../../main.js"></script> + + <script async src="../../search-index.js"></script> +</body> +</html>
\ No newline at end of file |