blob: ebca8052751081602eb8cc0db7d75ffff8ed3f4e [file] [log] [blame]
<!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 `rustyline` crate.">
<meta name="keywords" content="rust, rustlang, rust-lang, rustyline">
<title>rustyline - Rust</title>
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc mod">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Crate rustyline</p><div class="block items"><ul><li><a href="#reexports">Reexports</a></li><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#types">Type Definitions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'rustyline', ty: 'mod', relpath: '../'};</script>
</nav>
<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">
<h1 class='fqn'><span class='in-band'>Crate <a class="mod" href=''>rustyline</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'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../src/rustyline/lib.rs.html#1-1451' title='goto source code'>[src]</a></span></h1>
<div class='docblock'><p>Readline for Rust</p>
<p>This implementation is based on <a href="https://github.com/antirez/linenoise">Antirez&#39;s Linenoise</a></p>
<h1 id='example' class='section-header'><a href='#example'>Example</a></h1>
<p>Usage</p>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">rl</span> <span class="op">=</span> <span class="ident">rustyline</span>::<span class="ident">Editor</span>::<span class="op">&lt;</span>()<span class="op">&gt;</span>::<span class="ident">new</span>();
<span class="kw">let</span> <span class="ident">readline</span> <span class="op">=</span> <span class="ident">rl</span>.<span class="ident">readline</span>(<span class="string">&quot;&gt;&gt; &quot;</span>);
<span class="kw">match</span> <span class="ident">readline</span> {
<span class="prelude-val">Ok</span>(<span class="ident">line</span>) <span class="op">=&gt;</span> <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;Line: {:?}&quot;</span>,<span class="ident">line</span>),
<span class="prelude-val">Err</span>(_) <span class="op">=&gt;</span> <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;No input&quot;</span>),
}</pre>
</div><h2 id='reexports' class='section-header'><a href="#reexports">Reexports</a></h2>
<table><tr><td><code>pub use config::<a class="enum" href="../rustyline/config/enum.CompletionType.html" title="enum rustyline::config::CompletionType">CompletionType</a>;</code></td></tr><tr><td><code>pub use config::<a class="struct" href="../rustyline/config/struct.Config.html" title="struct rustyline::config::Config">Config</a>;</code></td></tr><tr><td><code>pub use config::<a class="enum" href="../rustyline/config/enum.EditMode.html" title="enum rustyline::config::EditMode">EditMode</a>;</code></td></tr><tr><td><code>pub use config::<a class="enum" href="../rustyline/config/enum.HistoryDuplicates.html" title="enum rustyline::config::HistoryDuplicates">HistoryDuplicates</a>;</code></td></tr></table><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table>
<tr class=' module-item'>
<td><a class="mod" href="completion/index.html"
title='mod rustyline::completion'>completion</a></td>
<td class='docblock-short'>
<p>Completion API</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="mod" href="config/index.html"
title='mod rustyline::config'>config</a></td>
<td class='docblock-short'>
<p>Customize line editor</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="mod" href="error/index.html"
title='mod rustyline::error'>error</a></td>
<td class='docblock-short'>
<p>Contains error type for handling I/O and Errno errors</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="mod" href="history/index.html"
title='mod rustyline::history'>history</a></td>
<td class='docblock-short'>
<p>History API</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="mod" href="line_buffer/index.html"
title='mod rustyline::line_buffer'>line_buffer</a></td>
<td class='docblock-short'>
<p>Line buffer with current cursor position</p>
</td>
</tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table>
<tr class=' module-item'>
<td><a class="struct" href="struct.Editor.html"
title='struct rustyline::Editor'>Editor</a></td>
<td class='docblock-short'>
<p>Line editor</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.Iter.html"
title='struct rustyline::Iter'>Iter</a></td>
<td class='docblock-short'>
</td>
</tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
<table>
<tr class=' module-item'>
<td><a class="enum" href="enum.Anchor.html"
title='enum rustyline::Anchor'>Anchor</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.At.html"
title='enum rustyline::At'>At</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.CharSearch.html"
title='enum rustyline::CharSearch'>CharSearch</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.Cmd.html"
title='enum rustyline::Cmd'>Cmd</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.KeyPress.html"
title='enum rustyline::KeyPress'>KeyPress</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.Movement.html"
title='enum rustyline::Movement'>Movement</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.Word.html"
title='enum rustyline::Word'>Word</a></td>
<td class='docblock-short'>
</td>
</tr></table><h2 id='types' class='section-header'><a href="#types">Type Definitions</a></h2>
<table>
<tr class=' module-item'>
<td><a class="type" href="type.RepeatCount.html"
title='type rustyline::RepeatCount'>RepeatCount</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="type" href="type.Result.html"
title='type rustyline::Result'>Result</a></td>
<td class='docblock-short'>
<p>The error type for I/O and Linux Syscalls (Errno)</p>
</td>
</tr></table></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<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>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "rustyline";
</script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>