blob: c2367ff556ab63672fdd5149a6090bd506f5634e [file] [log] [blame]
<!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="The main structure of the module, representing interest in some signals."><meta name="keywords" content="rust, rustlang, rust-lang, Signals"><title>Signals in signal_hook::iterator - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc struct"><!--[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">&#9776;</button><a class="sidebar-logo" href="../../signal_hook/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../signal_hook/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Signals</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.add_signal">add_signal</a></li><li><a href="#method.close">close</a></li><li><a href="#method.forever">forever</a></li><li><a href="#method.is_closed">is_closed</a></li><li><a href="#method.new">new</a></li><li><a href="#method.pending">pending</a></li><li><a href="#method.wait">wait</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Clone-for-Signals">Clone</a></li><li><a href="#impl-Debug-for-Signals">Debug</a></li><li><a href="#impl-IntoIterator-for-%26%27a%20Signals">IntoIterator</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-Signals">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Signals">Send</a></li><li><a href="#impl-Sync-for-Signals">Sync</a></li><li><a href="#impl-Unpin-for-Signals">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Signals">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-Signals">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Signals">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Signals">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Signals">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-Signals">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-Signals">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Signals">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-Signals">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In signal_hook::iterator</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="../index.html">signal_hook</a>::<wbr><a href="index.html">iterator</a>::<wbr><a class="struct" href="#">Signals</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/signal_hook/iterator.rs.html#162-165">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct Signals { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The main structure of the module, representing interest in some signals.</p>
<p>Unlike the helpers in other modules, this registers the signals when created and unregisters
them on drop. It provides the pending signals during its lifetime, either in batches or as an
infinite iterator.</p>
<h2 id="multiple-consumers"><a href="#multiple-consumers">Multiple consumers</a></h2>
<p>You may have noticed this structure can be used simultaneously by multiple threads. If it is
done, a signal arrives to one of the threads (on the first come, first serve basis). The signal
is <em>not</em> broadcasted to all currently active threads.</p>
<p>A similar thing applies to cloning the structure ‒ at least one of the copies gets the signal,
but it is not broadcasted to all of them.</p>
<p>If you need multiple recipients, you can create multiple independent instances (not by cloning,
but by the constructor).</p>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>signal_hook::iterator::Signals;
<span class="kw">let </span>signals = Signals::new(<span class="kw-2">&amp;</span>[signal_hook::SIGUSR1, signal_hook::SIGUSR2])<span class="question-mark">?</span>;
thread::spawn(<span class="kw">move </span>|| {
<span class="kw">for </span>signal <span class="kw">in </span><span class="kw-2">&amp;</span>signals {
<span class="kw">match </span>signal {
signal_hook::SIGUSR1 =&gt; {},
signal_hook::SIGUSR2 =&gt; {},
<span class="kw">_ </span>=&gt; <span class="macro">unreachable!</span>(),
}
}
});</code></pre></div>
<h2 id="mio-support"><a href="#mio-support"><code>mio</code> support</a></h2>
<p>If the crate is compiled with the <code>mio-support</code> or <code>mio-0_7-support</code> flags, the <code>Signals</code>
becomes pluggable into <code>mio</code> version <code>0.6</code> or <code>0.7</code> respectively (it implements the <code>Source</code>
trait). If it becomes readable, there may be new signals to pick up.</p>
<h2 id="tokio-support"><a href="#tokio-support"><code>tokio</code> support</a></h2>
<p>If the crate is compiled with the <code>tokio-support</code> flag, the <a href="#method.into_async"><code>into_async</code></a>
method becomes available. This method turns the iterator into an asynchronous stream of
received signals.</p>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Signals" class="impl has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#167-400">source</a><a href="#impl-Signals" class="anchor"></a><h3 class="code-header">impl <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#172-194">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>&lt;I, S&gt;(signals: I) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = S&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;<a class="type" href="../../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Creates the <code>Signals</code> structure.</p>
<p>This registers all the signals listed. The same restrictions (panics, errors) apply as with
<a href="../fn.register.html"><code>register</code></a>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.add_signal" class="method has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#212-233">source</a><h4 class="code-header">pub fn <a href="#method.add_signal" class="fnname">add_signal</a>(&amp;self, signal: <a class="type" href="../../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Registers another signal to the set watched by this <a href="struct.Signals.html" title="Signals"><code>Signals</code></a> instance.</p>
<h5 id="notes"><a href="#notes">Notes</a></h5>
<ul>
<li>This is safe to call concurrently from whatever thread.</li>
<li>This is <em>not</em> safe to call from within a signal handler.</li>
<li>If the signal number was already registered previously, this is a no-op.</li>
<li>If this errors, the original set of signals is left intact.</li>
<li>This actually registers the signal into the whole group of <a href="struct.Signals.html" title="Signals"><code>Signals</code></a> cloned from each
other, so any of them might start receiving the signals.</li>
</ul>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<ul>
<li>If the given signal is <a href="../constant.FORBIDDEN.html" title="crate::FORBIDDEN">forbidden</a>.</li>
<li>If the signal number is negative or larger than internal limit. The limit should be
larger than any supported signal the OS supports.</li>
</ul>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.pending" class="method has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#290-294">source</a><h4 class="code-header">pub fn <a href="#method.pending" class="fnname">pending</a>(&amp;self) -&gt; <a class="struct" href="struct.Pending.html" title="struct signal_hook::iterator::Pending">Pending</a>&lt;'_&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Pending.html" title="struct signal_hook::iterator::Pending">Pending</a>&lt;'a&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="struct.Pending.html" title="struct signal_hook::iterator::Pending">Pending</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="type" href="../../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>;</span></code></span></span></span></span></h4></section></summary><div class="docblock"><p>Returns an iterator of already received signals.</p>
<p>This returns an iterator over all the signal numbers of the signals received since last
time they were read (out of the set registered by this <code>Signals</code> instance). Note that they
are returned in arbitrary order and a signal number is returned only once even if it was
received multiple times.</p>
<p>This method returns immediately (does not block) and may produce an empty iterator if there
are no signals ready.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.wait" class="method has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#305-309">source</a><h4 class="code-header">pub fn <a href="#method.wait" class="fnname">wait</a>(&amp;self) -&gt; <a class="struct" href="struct.Pending.html" title="struct signal_hook::iterator::Pending">Pending</a>&lt;'_&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Pending.html" title="struct signal_hook::iterator::Pending">Pending</a>&lt;'a&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="struct.Pending.html" title="struct signal_hook::iterator::Pending">Pending</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="type" href="../../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>;</span></code></span></span></span></span></h4></section></summary><div class="docblock"><p>Waits for some signals to be available and returns an iterator.</p>
<p>This is similar to <a href="#method.pending"><code>pending</code></a>. If there are no signals available, it
tries to wait for some to arrive. However, due to implementation details, this still can
produce an empty iterator.</p>
<p>This can block for arbitrary long time.</p>
<p>Note that the blocking is done in this method, not in the iterator.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.forever" class="method has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#347-352">source</a><h4 class="code-header">pub fn <a href="#method.forever" class="fnname">forever</a>(&amp;self) -&gt; <a class="struct" href="struct.Forever.html" title="struct signal_hook::iterator::Forever">Forever</a>&lt;'_&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Forever.html" title="struct signal_hook::iterator::Forever">Forever</a>&lt;'a&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="struct.Forever.html" title="struct signal_hook::iterator::Forever">Forever</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="type" href="../../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>;</span></code></span></span></span></span></h4></section></summary><div class="docblock"><p>Returns an infinite iterator over arriving signals.</p>
<p>The iterator’s <code>next()</code> blocks as necessary to wait for signals to arrive. This is adequate
if you want to designate a thread solely to handling signals. If multiple signals come at
the same time (between two values produced by the iterator), they will be returned in
arbitrary order. Multiple instances of the same signal may be collated.</p>
<p>This is also the iterator returned by <code>IntoIterator</code> implementation on <code>&amp;Signals</code>.</p>
<p>This iterator terminates only if the <a href="struct.Signals.html" title="Signals"><code>Signals</code></a> is explicitly <a href="struct.Signals.html#method.close" title="Signals::close">closed</a>.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>signal_hook::iterator::Signals;
<span class="kw">let </span>signals = Signals::new(<span class="kw-2">&amp;</span>[signal_hook::SIGUSR1, signal_hook::SIGUSR2])<span class="question-mark">?</span>;
thread::spawn(<span class="kw">move </span>|| {
<span class="kw">for </span>signal <span class="kw">in </span>signals.forever() {
<span class="kw">match </span>signal {
signal_hook::SIGUSR1 =&gt; {},
signal_hook::SIGUSR2 =&gt; {},
<span class="kw">_ </span>=&gt; <span class="macro">unreachable!</span>(),
}
}
});</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_closed" class="method has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#357-359">source</a><h4 class="code-header">pub fn <a href="#method.is_closed" class="fnname">is_closed</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Is it closed?</p>
<p>See <a href="struct.Signals.html#method.close" title="Signals::close"><code>close</code></a>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.close" class="method has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#396-399">source</a><h4 class="code-header">pub fn <a href="#method.close" class="fnname">close</a>(&amp;self)</h4></section></summary><div class="docblock"><p>Closes the instance.</p>
<p>This is meant to signalize termination through all the interrelated instances ‒ the ones
created by cloning the same original <a href="struct.Signals.html" title="Signals"><code>Signals</code></a> instance (and all the [<code>Async</code>] ones
created from them). After calling close:</p>
<ul>
<li><a href="struct.Signals.html#method.is_closed" title="Signals::is_closed"><code>is_closed</code></a> will return true.</li>
<li>All currently blocking operations on all threads and all the instances are interrupted
and terminate.</li>
<li>Any further operations will never block.</li>
<li>Further signals may or may not be returned from the iterators. However, if any are
returned, these are real signals that happened.</li>
<li>The <a href="struct.Signals.html#method.forever" title="Signals::forever"><code>forever</code></a> terminates (follows from the above).</li>
</ul>
<p>The goal is to be able to shut down any background thread that handles only the signals.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>signals = Signals::new(<span class="kw-2">&amp;</span>[SIGUSR1])<span class="question-mark">?</span>;
<span class="kw">let </span>signals_bg = signals.clone();
<span class="kw">let </span>thread = std::thread::spawn(<span class="kw">move </span>|| {
<span class="kw">for </span>signal <span class="kw">in </span><span class="kw-2">&amp;</span>signals_bg {
<span class="comment">// Whatever with the signal
</span>}
});
signals.close();
<span class="comment">// The thread will terminate on its own now (the for cycle runs out of signals).
</span>thread.join().expect(<span class="string">&quot;background thread panicked&quot;</span>);</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Clone-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#161">source</a><a href="#impl-Clone-for-Signals" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#161">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#132-134">source</a></span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</h4></section></summary><div class='docblock'>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></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#161">source</a><a href="#impl-Debug-for-Signals" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#161">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-%26%27a%20Signals" class="impl has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#402-408">source</a><a href="#impl-IntoIterator-for-%26%27a%20Signals" class="anchor"></a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &amp;'a <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Item" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="rustdoc-toggle" open><summary><section id="associatedtype.IntoIter" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.IntoIter" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="struct.Forever.html" title="struct signal_hook::iterator::Forever">Forever</a>&lt;'a&gt;</h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_iter" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/signal_hook/iterator.rs.html#405-407">source</a><a href="#method.into_iter" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fnname">into_iter</a>(self) -&gt; <a class="struct" href="struct.Forever.html" title="struct signal_hook::iterator::Forever">Forever</a>&lt;'a&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Forever.html" title="struct signal_hook::iterator::Forever">Forever</a>&lt;'a&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="struct.Forever.html" title="struct signal_hook::iterator::Forever">Forever</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="type" href="../../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>;</span></code></span></span></span></span></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Signals" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-Signals" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h3></section><section id="impl-Send-for-Signals" class="impl has-srclink"><a href="#impl-Send-for-Signals" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h3></section><section id="impl-Sync-for-Signals" class="impl has-srclink"><a href="#impl-Sync-for-Signals" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h3></section><section id="impl-Unpin-for-Signals" class="impl has-srclink"><a href="#impl-Unpin-for-Signals" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h3></section><section id="impl-UnwindSafe-for-Signals" class="impl has-srclink"><a href="#impl-UnwindSafe-for-Signals" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Signals.html" title="struct signal_hook::iterator::Signals">Signals</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#200">source</a><a href="#impl-Any-for-Signals" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#201">source</a><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#211">source</a><a href="#impl-Borrow%3CT%3E-for-Signals" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213">source</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220">source</a><a href="#impl-BorrowMut%3CT%3E-for-Signals" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221">source</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#733">source</a><a href="#impl-From%3CT%3E-for-Signals" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#736">source</a></span><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#717">source</a><a href="#impl-Into%3CU%3E-for-Signals" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#725">source</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#83">source</a><a href="#impl-ToOwned-for-Signals" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#775">source</a><a href="#impl-TryFrom%3CU%3E-for-Signals" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#781">source</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-Signals" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#760">source</a><a href="#impl-TryInto%3CU%3E-for-Signals" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#766">source</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="signal_hook" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>