187 lines
8.6 KiB
HTML
187 lines
8.6 KiB
HTML
<!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 `qrcode` crate.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, qrcode">
|
||
|
||
<title>qrcode - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
|
||
<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]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'></p><script>window.sidebarCurrent = {name: 'qrcode', 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 mod">
|
||
<h1 class='fqn'><span class='in-band'>Crate <a class='mod' href=''>qrcode</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-0' class='srclink' href='../src/qrcode/src/lib.rs.html#1-315' title='goto source code'>[src]</a></span></h1>
|
||
<div class='docblock'><p>QRCode encoder</p>
|
||
|
||
<p>This crate provides a QR code and Micro QR code encoder for binary data.</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>image</span>;
|
||
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>qrcode</span>;
|
||
|
||
<span class='kw'>use</span> <span class='ident'>image</span>::<span class='ident'>GrayImage</span>;
|
||
<span class='kw'>use</span> <span class='ident'>qrcode</span>::<span class='ident'>QrCode</span>;
|
||
|
||
|
||
<span class='kw'>let</span> <span class='ident'>code</span> <span class='op'>=</span> <span class='ident'>QrCode</span>::<span class='ident'>new</span>(<span class='string'>b"Some content here."</span>);
|
||
<span class='kw'>match</span> <span class='ident'>code</span> {
|
||
<span class='prelude-val'>Err</span>(<span class='ident'>err</span>) <span class='op'>=></span> <span class='macro'>panic</span><span class='macro'>!</span>(<span class='string'>"Failed to encode the QR code: {:?}"</span>, <span class='ident'>err</span>),
|
||
<span class='prelude-val'>Ok</span>(<span class='ident'>code</span>) <span class='op'>=></span> {
|
||
<span class='kw'>let</span> <span class='ident'>image</span>: <span class='ident'>GrayImage</span> <span class='op'>=</span> <span class='ident'>code</span>.<span class='ident'>render</span>().<span class='ident'>min_width</span>(<span class='number'>100</span>).<span class='ident'>to_image</span>();
|
||
<span class='comment'>// render `image`...</span>
|
||
}
|
||
}
|
||
</pre>
|
||
</div><h2 id='reexports' class='section-header'><a href="#reexports">Reexports</a></h2>
|
||
<table><tr><td><code>pub use types::{<a class='type' href='../qrcode/types/type.QrResult.html' title='qrcode::types::QrResult'>QrResult</a>, <a class='enum' href='../qrcode/types/enum.EcLevel.html' title='qrcode::types::EcLevel'>EcLevel</a>, <a class='enum' href='../qrcode/types/enum.Version.html' title='qrcode::types::Version'>Version</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='bits/index.html'
|
||
title='qrcode::bits'>bits</a></td>
|
||
<td class='docblock short'>
|
||
<p>The <code>bits</code> module encodes binary data into raw bits used in a QR code.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='mod' href='canvas/index.html'
|
||
title='qrcode::canvas'>canvas</a></td>
|
||
<td class='docblock short'>
|
||
<p>The <code>canvas</code> module puts raw bits into the QR code canvas.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='mod' href='ec/index.html'
|
||
title='qrcode::ec'>ec</a></td>
|
||
<td class='docblock short'>
|
||
<p>The <code>ec</code> module applies the Reed-Solomon error correction codes.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='mod' href='optimize/index.html'
|
||
title='qrcode::optimize'>optimize</a></td>
|
||
<td class='docblock short'>
|
||
<p>Find the optimal data mode sequence to encode a piece of data.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='mod' href='render/index.html'
|
||
title='qrcode::render'>render</a></td>
|
||
<td class='docblock short'>
|
||
<p>Render a QR code into image.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='mod' href='types/index.html'
|
||
title='qrcode::types'>types</a></td>
|
||
<td class='docblock short'>
|
||
|
||
</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.QrCode.html'
|
||
title='qrcode::QrCode'>QrCode</a></td>
|
||
<td class='docblock short'>
|
||
<p>The encoded QR code symbol.</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>⇤</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>
|
||
<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 = "qrcode";
|
||
window.playgroundUrl = "";
|
||
</script>
|
||
<script src="../jquery.js"></script>
|
||
<script src="../main.js"></script>
|
||
|
||
<script defer src="../search-index.js"></script>
|
||
</body>
|
||
</html> |