rust-libnotify/glib/struct.FlagsBuilder.html

149 lines
10 KiB
HTML
Raw Normal View History

<!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 `FlagsBuilder` struct in crate `glib`.">
<meta name="keywords" content="rust, rustlang, rust-lang, FlagsBuilder">
<title>glib::FlagsBuilder - 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 struct">
<!--[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'>Struct FlagsBuilder</p><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.set">set</a><a href="#method.set_by_name">set_by_name</a><a href="#method.set_by_nick">set_by_nick</a><a href="#method.unset">unset</a><a href="#method.unset_by_name">unset_by_name</a><a href="#method.unset_by_nick">unset_by_nick</a><a href="#method.build">build</a></div></div><p class='location'><a href='index.html'>glib</a></p><script>window.sidebarCurrent = {name: 'FlagsBuilder', ty: 'struct', 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">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>glib</a>::<wbr><a class="struct" href=''>FlagsBuilder</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/glib/enums.rs.html#619' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct FlagsBuilder&lt;'a&gt;(_, _);</pre><div class='docblock'><p>Builder for conveniently setting/unsetting flags and returning a <code>Value</code>.</p>
<p>Example for getting a flags property, unsetting some flags and setting the updated flags on the
object again:</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
<span class="kw">let</span> <span class="ident">flags</span> <span class="op">=</span> <span class="ident">obj</span>.<span class="ident">get_property</span>(<span class="string">&quot;flags&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">flags_class</span> <span class="op">=</span> <span class="ident">FlagsClass</span>::<span class="ident">new</span>(<span class="ident">flags</span>.<span class="ident">type_</span>()).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">flags</span> <span class="op">=</span> <span class="ident">flags_class</span>.<span class="ident">builder_with_value</span>(<span class="ident">flags</span>).<span class="ident">unwrap</span>()
.<span class="ident">unset_by_nick</span>(<span class="string">&quot;some-flag&quot;</span>)
.<span class="ident">unset_by_nick</span>(<span class="string">&quot;some-other-flag&quot;</span>)
.<span class="ident">build</span>()
.<span class="ident">unwrap</span>();
<span class="ident">obj</span>.<span class="ident">set_property</span>(<span class="string">&quot;flags&quot;</span>, <span class="kw-2">&amp;</span><span class="ident">flags</span>).<span class="ident">unwrap</span>();</pre>
<p>If setting/unsetting any value fails, <code>build()</code> returns <code>None</code>.</p>
</div>
<h2 id='methods' class='small-section-header'>
Methods<a href='#methods' class='anchor'></a>
</h2>
<h3 id='impl' class='impl'><span class='in-band'><code>impl&lt;'a&gt; <a class="struct" href="../glib/struct.FlagsBuilder.html" title="struct glib::FlagsBuilder">FlagsBuilder</a>&lt;'a&gt;</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/glib/enums.rs.html#620-693' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.set' class="method"><span id='set.v' class='invisible'><code>pub fn <a href='#method.set' class='fnname'>set</a>(self, f: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/glib/enums.rs.html#636-642' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Sets flags corresponding to integer value <code>f</code>.</p>
</div><h4 id='method.set_by_name' class="method"><span id='set_by_name.v' class='invisible'><code>pub fn <a href='#method.set_by_name' class='fnname'>set_by_name</a>(self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/glib/enums.rs.html#645-651' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Sets flags corresponding to string name <code>name</code>.</p>
</div><h4 id='method.set_by_nick' class="method"><span id='set_by_nick.v' class='invisible'><code>pub fn <a href='#method.set_by_nick' class='fnname'>set_by_nick</a>(self, nick: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/glib/enums.rs.html#654-660' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Sets flags corresponding to string nick <code>nick</code>.</p>
</div><h4 id='method.unset' class="method"><span id='unset.v' class='invisible'><code>pub fn <a href='#method.unset' class='fnname'>unset</a>(self, f: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/glib/enums.rs.html#663-669' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Unsets flags corresponding to integer value <code>f</code>.</p>
</div><h4 id='method.unset_by_name' class="method"><span id='unset_by_name.v' class='invisible'><code>pub fn <a href='#method.unset_by_name' class='fnname'>unset_by_name</a>(self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/glib/enums.rs.html#672-678' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Unsets flags corresponding to string name <code>name</code>.</p>
</div><h4 id='method.unset_by_nick' class="method"><span id='unset_by_nick.v' class='invisible'><code>pub fn <a href='#method.unset_by_nick' class='fnname'>unset_by_nick</a>(self, nick: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/glib/enums.rs.html#681-687' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Unsets flags corresponding to string nick <code>nick</code>.</p>
</div><h4 id='method.build' class="method"><span id='build.v' class='invisible'><code>pub fn <a href='#method.build' class='fnname'>build</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../glib/value/struct.Value.html" title="struct glib::value::Value">Value</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/glib/enums.rs.html#690-692' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Converts to the final <code>Value</code>, unless any previous setting/unsetting of flags failed.</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>Switch tab</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt style="width:31px;">+ / -</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 = "glib";
</script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>