mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-10 01:58:23 +00:00
133 lines
31 KiB
HTML
133 lines
31 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="A set of defined flags using a bits type as storage."><title>Flags in bitflags - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-5bc39a1768837dd0.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bitflags" data-themes="" data-resource-suffix="" data-rustdoc-version="1.77.0 (aedd173a2 2024-03-17)" data-channel="1.77.0" data-search-js="search-dd67cee4cfa65049.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-4c98445ec4002617.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-48f368f3872407c8.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../bitflags/index.html">bitflags</a><span class="version">2.5.0</span></h2></div><h2 class="location"><a href="#">Flags</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Bits">Bits</a></li></ul><h3><a href="#required-associated-consts">Required Associated Constants</a></h3><ul class="block"><li><a href="#associatedconstant.FLAGS">FLAGS</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.bits">bits</a></li><li><a href="#tymethod.from_bits_retain">from_bits_retain</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.all">all</a></li><li><a href="#method.complement">complement</a></li><li><a href="#method.contains">contains</a></li><li><a href="#method.difference">difference</a></li><li><a href="#method.empty">empty</a></li><li><a href="#method.from_bits">from_bits</a></li><li><a href="#method.from_bits_truncate">from_bits_truncate</a></li><li><a href="#method.from_name">from_name</a></li><li><a href="#method.insert">insert</a></li><li><a href="#method.intersection">intersection</a></li><li><a href="#method.intersects">intersects</a></li><li><a href="#method.is_all">is_all</a></li><li><a href="#method.is_empty">is_empty</a></li><li><a href="#method.iter">iter</a></li><li><a href="#method.iter_names">iter_names</a></li><li><a href="#method.remove">remove</a></li><li><a href="#method.set">set</a></li><li><a href="#method.symmetric_difference">symmetric_difference</a></li><li><a href="#method.toggle">toggle</a></li><li><a href="#method.union">union</a></li></ul><h3><a href="#object-safety">Object Safety</a></h3><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In crate bitflags</a></h2></div></nav><div class="sidebar-resizer"></div>
|
||
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../bitflags/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="index.html">bitflags</a>::<wbr><a class="trait" href="#">Flags</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../src/bitflags/traits.rs.html#132-315">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub trait Flags: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'static {
|
||
type <a href="#associatedtype.Bits" class="associatedtype">Bits</a>: <a class="trait" href="trait.Bits.html" title="trait bitflags::Bits">Bits</a>;
|
||
|
||
const <a href="#associatedconstant.FLAGS" class="constant">FLAGS</a>: &'static [<a class="struct" href="struct.Flag.html" title="struct bitflags::Flag">Flag</a><Self>];
|
||
<details class="toggle type-contents-toggle"><summary class="hideme"><span>Show 22 methods</span></summary>
|
||
// Required methods
|
||
fn <a href="#tymethod.bits" class="fn">bits</a>(&self) -> Self::<a class="associatedtype" href="trait.Flags.html#associatedtype.Bits" title="type bitflags::Flags::Bits">Bits</a>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.from_bits_retain" class="fn">from_bits_retain</a>(bits: Self::<a class="associatedtype" href="trait.Flags.html#associatedtype.Bits" title="type bitflags::Flags::Bits">Bits</a>) -> Self;
|
||
|
||
// Provided methods
|
||
fn <a href="#method.empty" class="fn">empty</a>() -> Self { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.all" class="fn">all</a>() -> Self { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.from_bits" class="fn">from_bits</a>(bits: Self::<a class="associatedtype" href="trait.Flags.html#associatedtype.Bits" title="type bitflags::Flags::Bits">Bits</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.from_bits_truncate" class="fn">from_bits_truncate</a>(bits: Self::<a class="associatedtype" href="trait.Flags.html#associatedtype.Bits" title="type bitflags::Flags::Bits">Bits</a>) -> Self { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.from_name" class="fn">from_name</a>(name: &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.iter" class="fn">iter</a>(&self) -> <a class="struct" href="iter/struct.Iter.html" title="struct bitflags::iter::Iter">Iter</a><Self> <a href="#" class="tooltip" data-notable-ty="Iter<Self>">ⓘ</a> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.iter_names" class="fn">iter_names</a>(&self) -> <a class="struct" href="iter/struct.IterNames.html" title="struct bitflags::iter::IterNames">IterNames</a><Self> <a href="#" class="tooltip" data-notable-ty="IterNames<Self>">ⓘ</a> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.is_empty" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.is_all" class="fn">is_all</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.intersects" class="fn">intersects</a>(&self, other: Self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a>
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.contains" class="fn">contains</a>(&self, other: Self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a>
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.insert" class="fn">insert</a>(&mut self, other: Self)
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.remove" class="fn">remove</a>(&mut self, other: Self)
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.toggle" class="fn">toggle</a>(&mut self, other: Self)
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.set" class="fn">set</a>(&mut self, other: Self, value: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a>)
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.intersection" class="fn">intersection</a>(self, other: Self) -> Self { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.union" class="fn">union</a>(self, other: Self) -> Self { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.difference" class="fn">difference</a>(self, other: Self) -> Self { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.symmetric_difference" class="fn">symmetric_difference</a>(self, other: Self) -> Self { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.complement" class="fn">complement</a>(self) -> Self { ... }
|
||
</details>}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A set of defined flags using a bits type as storage.</p>
|
||
<h3 id="implementing-flags"><a class="doc-anchor" href="#implementing-flags">§</a>Implementing <code>Flags</code></h3>
|
||
<p>This trait is implemented by the <a href="macro.bitflags.html"><code>bitflags</code></a> macro:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitflags::bitflags;
|
||
|
||
<span class="macro">bitflags! </span>{
|
||
<span class="kw">struct </span>MyFlags: u8 {
|
||
<span class="kw">const </span>A = <span class="number">1</span>;
|
||
<span class="kw">const </span>B = <span class="number">1 </span><< <span class="number">1</span>;
|
||
}
|
||
}</code></pre></div>
|
||
<p>It can also be implemented manually:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitflags::{Flag, Flags};
|
||
|
||
<span class="kw">struct </span>MyFlags(u8);
|
||
|
||
<span class="kw">impl </span>Flags <span class="kw">for </span>MyFlags {
|
||
<span class="kw">const </span>FLAGS: <span class="kw-2">&</span><span class="lifetime">'static </span>[Flag<<span class="self">Self</span>>] = <span class="kw-2">&</span>[
|
||
Flag::new(<span class="string">"A"</span>, MyFlags(<span class="number">1</span>)),
|
||
Flag::new(<span class="string">"B"</span>, MyFlags(<span class="number">1 </span><< <span class="number">1</span>)),
|
||
];
|
||
|
||
<span class="kw">type </span>Bits = u8;
|
||
|
||
<span class="kw">fn </span>from_bits_retain(bits: <span class="self">Self</span>::Bits) -> <span class="self">Self </span>{
|
||
MyFlags(bits)
|
||
}
|
||
|
||
<span class="kw">fn </span>bits(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="self">Self</span>::Bits {
|
||
<span class="self">self</span>.<span class="number">0
|
||
</span>}
|
||
}</code></pre></div>
|
||
<h3 id="using-flags"><a class="doc-anchor" href="#using-flags">§</a>Using <code>Flags</code></h3>
|
||
<p>The <code>Flags</code> trait can be used generically to work with any flags types. In this example,
|
||
we can count the number of defined named flags:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>defined_flags<F: Flags>() -> usize {
|
||
F::FLAGS.iter().filter(|f| f.is_named()).count()
|
||
}
|
||
|
||
<span class="macro">bitflags! </span>{
|
||
<span class="kw">struct </span>MyFlags: u8 {
|
||
<span class="kw">const </span>A = <span class="number">1</span>;
|
||
<span class="kw">const </span>B = <span class="number">1 </span><< <span class="number">1</span>;
|
||
<span class="kw">const </span>C = <span class="number">1 </span><< <span class="number">2</span>;
|
||
|
||
<span class="kw">const _ </span>= !<span class="number">0</span>;
|
||
}
|
||
}
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="number">3</span>, defined_flags::<MyFlags>());</code></pre></div>
|
||
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Bits" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#137">source</a><h4 class="code-header">type <a href="#associatedtype.Bits" class="associatedtype">Bits</a>: <a class="trait" href="trait.Bits.html" title="trait bitflags::Bits">Bits</a></h4></section></summary><div class="docblock"><p>The underlying bits type.</p>
|
||
</div></details></div><h2 id="required-associated-consts" class="section-header">Required Associated Constants<a href="#required-associated-consts" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedconstant.FLAGS" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#134">source</a><h4 class="code-header">const <a href="#associatedconstant.FLAGS" class="constant">FLAGS</a>: &'static [<a class="struct" href="struct.Flag.html" title="struct bitflags::Flag">Flag</a><Self>]</h4></section></summary><div class="docblock"><p>The set of defined flags.</p>
|
||
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.bits" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#158">source</a><h4 class="code-header">fn <a href="#tymethod.bits" class="fn">bits</a>(&self) -> Self::<a class="associatedtype" href="trait.Flags.html#associatedtype.Bits" title="type bitflags::Flags::Bits">Bits</a></h4></section></summary><div class="docblock"><p>Get the underlying bits value.</p>
|
||
<p>The returned value is exactly the bits set in this flags value.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.from_bits_retain" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#179">source</a><h4 class="code-header">fn <a href="#tymethod.from_bits_retain" class="fn">from_bits_retain</a>(bits: Self::<a class="associatedtype" href="trait.Flags.html#associatedtype.Bits" title="type bitflags::Flags::Bits">Bits</a>) -> Self</h4></section></summary><div class="docblock"><p>Convert from a bits value exactly.</p>
|
||
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.empty" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#140-142">source</a><h4 class="code-header">fn <a href="#method.empty" class="fn">empty</a>() -> Self</h4></section></summary><div class="docblock"><p>Get a flags value with all bits unset.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.all" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#145-153">source</a><h4 class="code-header">fn <a href="#method.all" class="fn">all</a>() -> Self</h4></section></summary><div class="docblock"><p>Get a flags value with all known bits set.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_bits" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#163-171">source</a><h4 class="code-header">fn <a href="#method.from_bits" class="fn">from_bits</a>(bits: Self::<a class="associatedtype" href="trait.Flags.html#associatedtype.Bits" title="type bitflags::Flags::Bits">Bits</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Convert from a bits value.</p>
|
||
<p>This method will return <code>None</code> if any unknown bits are set.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_bits_truncate" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#174-176">source</a><h4 class="code-header">fn <a href="#method.from_bits_truncate" class="fn">from_bits_truncate</a>(bits: Self::<a class="associatedtype" href="trait.Flags.html#associatedtype.Bits" title="type bitflags::Flags::Bits">Bits</a>) -> Self</h4></section></summary><div class="docblock"><p>Convert from a bits value, unsetting any unknown bits.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_name" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#185-198">source</a><h4 class="code-header">fn <a href="#method.from_name" class="fn">from_name</a>(name: &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Get a flags value with the bits of a flag with the given name set.</p>
|
||
<p>This method will return <code>None</code> if <code>name</code> is empty or doesn’t
|
||
correspond to any named flag.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.iter" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#204-206">source</a><h4 class="code-header">fn <a href="#method.iter" class="fn">iter</a>(&self) -> <a class="struct" href="iter/struct.Iter.html" title="struct bitflags::iter::Iter">Iter</a><Self> <a href="#" class="tooltip" data-notable-ty="Iter<Self>">ⓘ</a></h4></section></summary><div class="docblock"><p>Yield a set of contained flags values.</p>
|
||
<p>Each yielded flags value will correspond to a defined named flag. Any unknown bits
|
||
will be yielded together as a final flags value.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.iter_names" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#212-214">source</a><h4 class="code-header">fn <a href="#method.iter_names" class="fn">iter_names</a>(&self) -> <a class="struct" href="iter/struct.IterNames.html" title="struct bitflags::iter::IterNames">IterNames</a><Self> <a href="#" class="tooltip" data-notable-ty="IterNames<Self>">ⓘ</a></h4></section></summary><div class="docblock"><p>Yield a set of contained named flags values.</p>
|
||
<p>This method is like <a href="trait.Flags.html#method.iter" title="method bitflags::Flags::iter"><code>Flags::iter</code></a>, except only yields bits in contained named flags.
|
||
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#217-219">source</a><h4 class="code-header">fn <a href="#method.is_empty" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Whether all bits in this flags value are unset.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_all" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#222-226">source</a><h4 class="code-header">fn <a href="#method.is_all" class="fn">is_all</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Whether all known bits in this flags value are set.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.intersects" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#229-234">source</a><h4 class="code-header">fn <a href="#method.intersects" class="fn">intersects</a>(&self, other: Self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Whether any set bits in a source flags value are also set in a target flags value.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.contains" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#237-242">source</a><h4 class="code-header">fn <a href="#method.contains" class="fn">contains</a>(&self, other: Self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Whether all set bits in a source flags value are also set in a target flags value.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#245-250">source</a><h4 class="code-header">fn <a href="#method.insert" class="fn">insert</a>(&mut self, other: Self)<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>The bitwise or (<code>|</code>) of the bits in two flags values.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remove" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#256-261">source</a><h4 class="code-header">fn <a href="#method.remove" class="fn">remove</a>(&mut self, other: Self)<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>The intersection of a source flags value with the complement of a target flags value (<code>&!</code>).</p>
|
||
<p>This method is not equivalent to <code>self & !other</code> when <code>other</code> has unknown bits set.
|
||
<code>remove</code> won’t truncate <code>other</code>, but the <code>!</code> operator will.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.toggle" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#264-269">source</a><h4 class="code-header">fn <a href="#method.toggle" class="fn">toggle</a>(&mut self, other: Self)<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>The bitwise exclusive-or (<code>^</code>) of the bits in two flags values.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#272-281">source</a><h4 class="code-header">fn <a href="#method.set" class="fn">set</a>(&mut self, other: Self, value: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/core/primitive.bool.html">bool</a>)<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Call <a href="trait.Flags.html#method.insert" title="method bitflags::Flags::insert"><code>Flags::insert</code></a> when <code>value</code> is <code>true</code> or <a href="trait.Flags.html#method.remove" title="method bitflags::Flags::remove"><code>Flags::remove</code></a> when <code>value</code> is <code>false</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.intersection" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#285-287">source</a><h4 class="code-header">fn <a href="#method.intersection" class="fn">intersection</a>(self, other: Self) -> Self</h4></section></summary><div class="docblock"><p>The bitwise and (<code>&</code>) of the bits in two flags values.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.union" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#291-293">source</a><h4 class="code-header">fn <a href="#method.union" class="fn">union</a>(self, other: Self) -> Self</h4></section></summary><div class="docblock"><p>The bitwise or (<code>|</code>) of the bits in two flags values.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.difference" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#300-302">source</a><h4 class="code-header">fn <a href="#method.difference" class="fn">difference</a>(self, other: Self) -> Self</h4></section></summary><div class="docblock"><p>The intersection of a source flags value with the complement of a target flags value (<code>&!</code>).</p>
|
||
<p>This method is not equivalent to <code>self & !other</code> when <code>other</code> has unknown bits set.
|
||
<code>difference</code> won’t truncate <code>other</code>, but the <code>!</code> operator will.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.symmetric_difference" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#306-308">source</a><h4 class="code-header">fn <a href="#method.symmetric_difference" class="fn">symmetric_difference</a>(self, other: Self) -> Self</h4></section></summary><div class="docblock"><p>The bitwise exclusive-or (<code>^</code>) of the bits in two flags values.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.complement" class="method"><a class="src rightside" href="../src/bitflags/traits.rs.html#312-314">source</a><h4 class="code-header">fn <a href="#method.complement" class="fn">complement</a>(self) -> Self</h4></section></summary><div class="docblock"><p>The bitwise negation (<code>!</code>) of the bits in a flags value, truncating the result.</p>
|
||
</div></details></div><h2 id="object-safety" class="section-header">Object Safety<a href="#object-safety" class="anchor">§</a></h2><div class="object-safety-info">This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.77.0/reference/items/traits.html#object-safety">object safe</a>.</div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../trait.impl/bitflags/traits/trait.Flags.js" async></script><script type="text/json" id="notable-traits-data">{"Iter<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"iter/struct.Iter.html\" title=\"struct bitflags::iter::Iter\">Iter</a><B></code></h3><pre><code><div class=\"where\">impl<B: <a class=\"trait\" href=\"trait.Flags.html\" title=\"trait bitflags::Flags\">Flags</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"iter/struct.Iter.html\" title=\"struct bitflags::iter::Iter\">Iter</a><B></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = B;</div>","IterNames<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"iter/struct.IterNames.html\" title=\"struct bitflags::iter::IterNames\">IterNames</a><B></code></h3><pre><code><div class=\"where\">impl<B: <a class=\"trait\" href=\"trait.Flags.html\" title=\"trait bitflags::Flags\">Flags</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"iter/struct.IterNames.html\" title=\"struct bitflags::iter::IterNames\">IterNames</a><B></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = (&'static <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/core/primitive.str.html\">str</a>, B);</div>"}</script></section></div></main></body></html> |