image2aa 0.1.4

Convert image to ASCII Art.
Documentation
<!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="This crate exports a macro `enum_from_primitive!` that wraps an `enum` declaration and automatically adds an implementation of `num::FromPrimitive` (reexported here), to allow conversion from primitive integers to the enum.  It therefore provides an alternative to the built-in `#[derive(FromPrimitive)]`, which requires the unstable `std::num::FromPrimitive` and is disabled in Rust 1.0."><meta name="keywords" content="rust, rustlang, rust-lang, enum_primitive"><title>enum_primitive - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css"  id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../enum_primitive/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Crate enum_primitive</h2><div class="block version"><p>Version 0.1.1</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all enum_primitive's items</p></a><div class="block items"><ul><li><a href="#macros">Macros</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></div><div id="sidebar-vars" data-name="enum_primitive" data-ty="mod" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img src="../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img src="../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">enum_primitive</a><button id="copy-path" onclick="copy_path(this)" title="copy path"><img src="../clipboard.svg" width="19" height="18" alt="Copy item import" title="Copy item import to clipboard"></button></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/enum_primitive/lib.rs.html#23-196" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This crate exports a macro <code>enum_from_primitive!</code> that wraps an
<code>enum</code> declaration and automatically adds an implementation of
<code>num::FromPrimitive</code> (reexported here), to allow conversion from
primitive integers to the enum.  It therefore provides an
alternative to the built-in <code>#[derive(FromPrimitive)]</code>, which
requires the unstable <code>std::num::FromPrimitive</code> and is disabled in
Rust 1.0.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span> <span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">enum_primitive</span>;
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">num_traits</span>;
<span class="kw">use</span> <span class="ident">num_traits::FromPrimitive</span>;

<span class="macro">enum_from_primitive!</span> {
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">PartialEq</span>)]</span>
<span class="kw">enum</span> <span class="ident">FooBar</span> {
    <span class="ident">Foo</span> <span class="op">=</span> <span class="number">17</span>,
    <span class="ident">Bar</span> <span class="op">=</span> <span class="number">42</span>,
    <span class="ident">Baz</span>,
}
}

<span class="kw">fn</span> <span class="ident">main</span>() {
    <span class="macro">assert_eq!</span>(<span class="ident">FooBar::from_i32</span>(<span class="number">17</span>), <span class="prelude-val">Some</span>(<span class="ident">FooBar::Foo</span>));
    <span class="macro">assert_eq!</span>(<span class="ident">FooBar::from_i32</span>(<span class="number">42</span>), <span class="prelude-val">Some</span>(<span class="ident">FooBar::Bar</span>));
    <span class="macro">assert_eq!</span>(<span class="ident">FooBar::from_i32</span>(<span class="number">43</span>), <span class="prelude-val">Some</span>(<span class="ident">FooBar::Baz</span>));
    <span class="macro">assert_eq!</span>(<span class="ident">FooBar::from_i32</span>(<span class="number">91</span>), <span class="prelude-val">None</span>);
}</pre></div>
</div></details><h2 id="macros" class="section-header"><a href="#macros">Macros</a></h2>
<table><tr class="module-item"><td><a class="macro" href="macro.enum_from_primitive.html" title="enum_primitive::enum_from_primitive macro">enum_from_primitive</a></td><td class="docblock-short"><p>Wrap this macro around an <code>enum</code> declaration to get an
automatically generated implementation of <code>num::FromPrimitive</code>.</p>
</td></tr><tr class="module-item"><td><a class="macro" href="macro.enum_from_primitive_impl.html" title="enum_primitive::enum_from_primitive_impl macro">enum_from_primitive_impl</a></td><td class="docblock-short"><p>Helper macro for internal use by <code>enum_from_primitive!</code>.</p>
</td></tr><tr class="module-item"><td><a class="macro" href="macro.enum_from_primitive_impl_ty.html" title="enum_primitive::enum_from_primitive_impl_ty macro">enum_from_primitive_impl_ty</a></td><td class="docblock-short"><p>Helper macro for internal use by <code>enum_from_primitive!</code>.</p>
</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.Option.html" title="enum_primitive::Option enum">Option</a></td><td class="docblock-short"><p>The <code>Option</code> type. See <a href="https://doc.rust-lang.org/1.54.0/core/option/index.html">the module level documentation</a> for more.</p>
</td></tr></table><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
<table><tr class="module-item"><td><a class="trait" href="trait.FromPrimitive.html" title="enum_primitive::FromPrimitive trait">FromPrimitive</a></td><td class="docblock-short"><p>A generic trait for converting a number to a value.</p>
</td></tr></table></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="enum_primitive" data-search-index-js="../search-index.js" data-search-js="../search.js"></div><script src="../main.js"></script></body></html>