185 lines
17 KiB
HTML
185 lines
17 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 `Mode` enum in crate `qrcode`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, Mode">
|
||
|
||
<title>qrcode::types::Mode - 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'><a href='../index.html'>qrcode</a>::<wbr><a href='index.html'>types</a></p><script>window.sidebarCurrent = {name: 'Mode', ty: 'enum', relpath: ''};</script><script defer src="sidebar-items.js"></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 enum">
|
||
<h1 class='fqn'><span class='in-band'>Enum <a href='../index.html'>qrcode</a>::<wbr><a href='index.html'>types</a>::<wbr><a class='enum' href=''>Mode</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-151' class='srclink' href='../../src/qrcode/src/types.rs.html#146-159' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust enum'>pub enum Mode {
|
||
Numeric,
|
||
Alphanumeric,
|
||
Byte,
|
||
Kanji,
|
||
}</pre><div class='docblock'><p>The mode indicator, which specifies the character set of the encoded data.</p>
|
||
</div><h2 class='variants'>Variants</h2>
|
||
<table class='variants_table'><tr><td id='variant.Numeric'><code>Numeric</code></td><td><div class='docblock'><p>The data contains only characters 0 to 9.</p>
|
||
</div></td><td></td></tr><tr><td id='variant.Alphanumeric'><code>Alphanumeric</code></td><td><div class='docblock'><p>The data contains only uppercase letters (A–Z), numbers (0–9) and a few
|
||
punctuations marks (space, <code>$</code>, <code>%</code>, <code>*</code>, <code>+</code>, <code>-</code>, <code>.</code>, <code>/</code>, <code>:</code>).</p>
|
||
</div></td><td></td></tr><tr><td id='variant.Byte'><code>Byte</code></td><td><div class='docblock'><p>The data contains arbitrary binary data.</p>
|
||
</div></td><td></td></tr><tr><td id='variant.Kanji'><code>Kanji</code></td><td><div class='docblock'><p>The data contains Shift-JIS-encoded double-byte text.</p>
|
||
</div></td><td></td></tr></table><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-177' class='srclink' href='../../src/qrcode/src/types.rs.html#161-235' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.length_bits_count' class='method'><code>fn <a href='#method.length_bits_count' class='fnname'>length_bits_count</a>(&self, version: <a class='enum' href='../../qrcode/types/enum.Version.html' title='qrcode::types::Version'>Version</a>) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a></code></h4>
|
||
<div class='docblock'><p>Computes the number of bits needed to encode the data length.</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>qrcode</span>::<span class='ident'>types</span>::{<span class='ident'>Version</span>, <span class='ident'>Mode</span>};
|
||
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>Mode</span>::<span class='ident'>Numeric</span>.<span class='ident'>length_bits_count</span>(<span class='ident'>Version</span>::<span class='ident'>Normal</span>(<span class='number'>1</span>)), <span class='number'>10</span>);</pre>
|
||
|
||
<p>This method will return <code>Err(QrError::UnsupportedCharacterSet)</code> if the
|
||
mode is not supported in the given version.</p>
|
||
</div><h4 id='method.data_bits_count' class='method'><code>fn <a href='#method.data_bits_count' class='fnname'>data_bits_count</a>(&self, raw_data_len: <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></code></h4>
|
||
<div class='docblock'><p>Computes the number of bits needed to some data of a given raw length.</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>qrcode</span>::<span class='ident'>types</span>::<span class='ident'>Mode</span>;
|
||
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>Mode</span>::<span class='ident'>Numeric</span>.<span class='ident'>data_bits_count</span>(<span class='number'>7</span>), <span class='number'>24</span>);</pre>
|
||
|
||
<p>Note that in Kanji mode, the <code>raw_data_len</code> is the number of Kanjis,
|
||
i.e. half the total size of bytes.</p>
|
||
</div><h4 id='method.max' class='method'><code>fn <a href='#method.max' class='fnname'>max</a>(&self, other: <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a>) -> <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a></code></h4>
|
||
<div class='docblock'><p>Find the lowest common mode which both modes are compatible with.</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>qrcode</span>::<span class='ident'>types</span>::<span class='ident'>Mode</span>;
|
||
|
||
<span class='kw'>let</span> <span class='ident'>a</span> <span class='op'>=</span> <span class='ident'>Mode</span>::<span class='ident'>Numeric</span>;
|
||
<span class='kw'>let</span> <span class='ident'>b</span> <span class='op'>=</span> <span class='ident'>Mode</span>::<span class='ident'>Kanji</span>;
|
||
<span class='kw'>let</span> <span class='ident'>c</span> <span class='op'>=</span> <span class='ident'>a</span>.<span class='ident'>max</span>(<span class='ident'>b</span>);
|
||
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='ident'>a</span> <span class='op'><=</span> <span class='ident'>c</span>);
|
||
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='ident'>b</span> <span class='op'><=</span> <span class='ident'>c</span>);</pre>
|
||
</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/cmp/trait.PartialOrd.html' title='core::cmp::PartialOrd'>PartialOrd</a> for <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-190' class='srclink' href='../../src/qrcode/src/types.rs.html#237-254' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.partial_cmp' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a>) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='enum' href='https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html' title='core::cmp::Ordering'>Ordering</a>></code></h4>
|
||
<div class='docblock'><p>Defines a partial ordering between modes. If <code>a <= b</code>, then <code>b</code> contains
|
||
a superset of all characters supported by <code>a</code>.</p>
|
||
</div><h4 id='method.lt' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: &Rhs) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></h4>
|
||
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
||
</div><h4 id='method.le' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: &Rhs) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></h4>
|
||
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
||
</div><h4 id='method.gt' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: &Rhs) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></h4>
|
||
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
||
</div><h4 id='method.ge' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: &Rhs) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></h4>
|
||
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
||
</div></div><h3 id='derived_implementations'>Derived Implementations </h3><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> for <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-156' class='srclink' href='../../src/qrcode/src/types.rs.html#145' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.clone' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a></code></h4>
|
||
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
||
</div><h4 id='method.clone_from' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &Self)</code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></h4>
|
||
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html' title='core::marker::Copy'>Copy</a> for <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-159' class='srclink' href='../../src/qrcode/src/types.rs.html#145' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> for <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-160' class='srclink' href='../../src/qrcode/src/types.rs.html#145' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-163' class='srclink' href='../../src/qrcode/src/types.rs.html#145' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.eq' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, __arg_0: &<a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a>) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
|
||
</div><h4 id='method.ne' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: &Rhs) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></h4>
|
||
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='enum' href='../../qrcode/types/enum.Mode.html' title='qrcode::types::Mode'>Mode</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-169' class='srclink' href='../../src/qrcode/src/types.rs.html#145' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.fmt' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, __arg_0: &mut <a class='struct' href='https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -> <a class='type' href='https://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></h4>
|
||
<div class='docblock'><p>Formats the value using the given formatter.</p>
|
||
</div></div></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> |