Update doc for version = "0.2.0" (2907ca09d9ebd869af23a490322dc22cbb9ef6b2)
This commit is contained in:
parent
8a58a2f1d5
commit
98ca433264
|
@ -47,7 +47,7 @@
|
|||
<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-292' title='goto source code'>[src]</a></span></h1>
|
||||
</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>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<pre class='rust struct'>pub struct QrCode {
|
||||
// some fields omitted
|
||||
}</pre><div class='docblock'><p>The encoded QR code symbol.</p>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class='struct' href='../qrcode/struct.QrCode.html' title='qrcode::QrCode'>QrCode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1144' class='srclink' href='../src/qrcode/src/lib.rs.html#55-204' title='goto source code'>[src]</a></span></h3>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class='struct' href='../qrcode/struct.QrCode.html' title='qrcode::QrCode'>QrCode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1144' class='srclink' href='../src/qrcode/src/lib.rs.html#55-227' title='goto source code'>[src]</a></span></h3>
|
||||
<div class='impl-items'><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a><D: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>[</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>>>(data: D) -> <a class='type' href='../qrcode/types/type.QrResult.html' title='qrcode::types::QrResult'>QrResult</a><<a class='struct' href='../qrcode/struct.QrCode.html' title='qrcode::QrCode'>QrCode</a>></code></h4>
|
||||
<div class='docblock'><p>Constructs a new QR code which automatically encodes the given data.</p>
|
||||
|
||||
|
@ -137,7 +137,24 @@ color of the module, with "true" means dark and "false" mean
|
|||
<div class='docblock'><p>Converts the QR code to a vector of booleans. Each entry represents the
|
||||
color of the module, with "true" means dark and "false" means light.</p>
|
||||
</div><h4 id='method.render' class='method'><code>fn <a href='#method.render' class='fnname'>render</a><P: <a class='trait' href='../qrcode/render/trait.BlankAndWhitePixel.html' title='qrcode::render::BlankAndWhitePixel'>BlankAndWhitePixel</a> + 'static>(&self) -> <a class='struct' href='../qrcode/render/struct.Renderer.html' title='qrcode::render::Renderer'>Renderer</a><P></code></h4>
|
||||
</div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html' title='core::ops::Index'>Index</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>, <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>)</a>> for <a class='struct' href='../qrcode/struct.QrCode.html' title='qrcode::QrCode'>QrCode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1203' class='srclink' href='../src/qrcode/src/lib.rs.html#206-213' title='goto source code'>[src]</a></span></h3>
|
||||
<div class='docblock'><p>Renders the QR code into an image. The result is an image builder, which
|
||||
you may do some additional configuration before copying it into a
|
||||
concrete image.</p>
|
||||
|
||||
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
|
||||
<pre class='rust rust-example-rendered'>
|
||||
|
||||
<span class='kw'>let</span> <span class='ident'>image</span> <span class='op'>=</span> <span class='ident'>QrCode</span>::<span class='ident'>new</span>(<span class='string'>b"hello"</span>).<span class='ident'>unwrap</span>()
|
||||
.<span class='ident'>render</span>()
|
||||
.<span class='ident'>dark_color</span>(<span class='ident'>Rgb</span> { <span class='ident'>data</span>: [<span class='number'>0</span>, <span class='number'>0</span>, <span class='number'>128</span>] })
|
||||
.<span class='ident'>light_color</span>(<span class='ident'>Rgb</span> { <span class='ident'>data</span>: [<span class='number'>224</span>, <span class='number'>224</span>, <span class='number'>224</span>] }) <span class='comment'>// adjust colors</span>
|
||||
.<span class='ident'>quiet_zone</span>(<span class='boolvalue'>false</span>) <span class='comment'>// disable quiet zone (white border)</span>
|
||||
.<span class='ident'>min_width</span>(<span class='number'>300</span>) <span class='comment'>// sets minimum image size</span>
|
||||
.<span class='ident'>to_image</span>();</pre>
|
||||
|
||||
<p>Note: the <code>image</code> crate itself also provides method to rotate the image,
|
||||
or overlay a logo on top of the QR code.</p>
|
||||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html' title='core::ops::Index'>Index</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>, <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>)</a>> for <a class='struct' href='../qrcode/struct.QrCode.html' title='qrcode::QrCode'>QrCode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1203' class='srclink' href='../src/qrcode/src/lib.rs.html#229-236' title='goto source code'>[src]</a></span></h3>
|
||||
<div class='impl-items'><h4 id='associatedtype.Output' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#associatedtype.Output' class='type'>Output</a> = <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||||
<div class='docblock'><p>The returned type after indexing</p>
|
||||
</div><h4 id='method.index' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#tymethod.index' class='fnname'>index</a>(&self, (x, y): <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>, <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>)</a>) -> &<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -335,6 +335,29 @@
|
|||
<span id="291">291</span>
|
||||
<span id="292">292</span>
|
||||
<span id="293">293</span>
|
||||
<span id="294">294</span>
|
||||
<span id="295">295</span>
|
||||
<span id="296">296</span>
|
||||
<span id="297">297</span>
|
||||
<span id="298">298</span>
|
||||
<span id="299">299</span>
|
||||
<span id="300">300</span>
|
||||
<span id="301">301</span>
|
||||
<span id="302">302</span>
|
||||
<span id="303">303</span>
|
||||
<span id="304">304</span>
|
||||
<span id="305">305</span>
|
||||
<span id="306">306</span>
|
||||
<span id="307">307</span>
|
||||
<span id="308">308</span>
|
||||
<span id="309">309</span>
|
||||
<span id="310">310</span>
|
||||
<span id="311">311</span>
|
||||
<span id="312">312</span>
|
||||
<span id="313">313</span>
|
||||
<span id="314">314</span>
|
||||
<span id="315">315</span>
|
||||
<span id="316">316</span>
|
||||
</pre><pre class='rust '>
|
||||
<span class='doccomment'>//! QRCode encoder</span>
|
||||
<span class='doccomment'>//!</span>
|
||||
|
@ -534,6 +557,29 @@
|
|||
<span class='self'>self</span>.<span class='ident'>content</span>
|
||||
}
|
||||
|
||||
<span class='doccomment'>/// Renders the QR code into an image. The result is an image builder, which</span>
|
||||
<span class='doccomment'>/// you may do some additional configuration before copying it into a</span>
|
||||
<span class='doccomment'>/// concrete image.</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// # Examples</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// ```</span>
|
||||
<span class='doccomment'>/// # extern crate image;</span>
|
||||
<span class='doccomment'>/// # extern crate qrcode;</span>
|
||||
<span class='doccomment'>/// # use qrcode::QrCode;</span>
|
||||
<span class='doccomment'>/// # use image::Rgb;</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// let image = QrCode::new(b"hello").unwrap()</span>
|
||||
<span class='doccomment'>/// .render()</span>
|
||||
<span class='doccomment'>/// .dark_color(Rgb { data: [0, 0, 128] })</span>
|
||||
<span class='doccomment'>/// .light_color(Rgb { data: [224, 224, 224] }) // adjust colors</span>
|
||||
<span class='doccomment'>/// .quiet_zone(false) // disable quiet zone (white border)</span>
|
||||
<span class='doccomment'>/// .min_width(300) // sets minimum image size</span>
|
||||
<span class='doccomment'>/// .to_image();</span>
|
||||
<span class='doccomment'>/// ```</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// Note: the `image` crate itself also provides method to rotate the image,</span>
|
||||
<span class='doccomment'>/// or overlay a logo on top of the QR code.</span>
|
||||
<span class='attribute'>#[<span class='ident'>cfg</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"image"</span>)]</span>
|
||||
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>render</span><span class='op'><</span><span class='ident'>P</span>: <span class='ident'>BlankAndWhitePixel</span> <span class='op'>+</span> <span class='lifetime'>'static</span><span class='op'>></span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Renderer</span><span class='op'><</span><span class='ident'>P</span><span class='op'>></span> {
|
||||
<span class='kw'>let</span> <span class='ident'>quiet_zone</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='self'>self</span>.<span class='ident'>version</span>.<span class='ident'>is_micro</span>() { <span class='number'>2</span> } <span class='kw'>else</span> { <span class='number'>4</span> };
|
||||
|
|
Loading…
Reference in a new issue