260 lines
13 KiB
HTML
260 lines
13 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 `pnmixerlib` crate.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, pnmixerlib">
|
||
|
||
<title>pnmixerlib - 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 mod">
|
||
<!--[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'>Crate pnmixerlib</p><div class="block items"><ul><li><a href="#reexports">Reexports</a></li><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'pnmixerlib', ty: 'mod', relpath: '../'};</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'>Crate <a class="mod" href=''>pnmixerlib</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 class='srclink' href='../src/pnmixerlib/lib.rs.html#1-99' title='goto source code'>[src]</a></span></h1>
|
||
<div class='docblock'><p>PNMixer-rs is a mixer for the system tray.</p>
|
||
|
||
<h1 id='design-overview' class='section-header'><a href='#design-overview'>Design Overview</a></h1>
|
||
<p>The lowest level part of the code is the sound backend. Only Alsa is supported
|
||
at the moment, but more backends may be added in the future.</p>
|
||
|
||
<p>The backend is hidden behind a frontend, defined in <code>audio.rs</code>. Only <code>audio.rs</code>
|
||
deals with audio backends. This means that the whole of the code is blissfully
|
||
ignorant of the audio backend in use.</p>
|
||
|
||
<p><code>audio.rs</code> is also in charge of emitting signals whenever a change happens.
|
||
This means that PNMixer-rs design is quite signal-oriented, so to say.</p>
|
||
|
||
<p>The ui code is nothing fancy. Each ui element...</p>
|
||
|
||
<ul>
|
||
<li>is defined in a single file</li>
|
||
<li>strives to be standalone</li>
|
||
<li>accesses the sound system with function calls</li>
|
||
<li>listens to signals from the audio subsystem to update its appearance</li>
|
||
</ul>
|
||
|
||
<p>There's something you should keep in mind. Audio on a computer is a shared
|
||
resource. PNMixer-rs isn't the only one that can change it. At any moment the
|
||
audio volume may be modified by someone else, and we must update the ui
|
||
accordingly. So listening to changes from the audio subsystem (and therefore
|
||
having a signal-oriented design) is the most obvious solution to solve that
|
||
problem.</p>
|
||
</div><h2 id='reexports' class='section-header'><a href="#reexports">Reexports</a></h2>
|
||
<table><tr><td><code>pub extern crate <a class="mod" href="../flexi_logger/index.html" title="mod flexi_logger">flexi_logger</a>;</code></td></tr><tr><td><code>pub extern crate <a class="mod" href="../gtk/index.html" title="mod gtk">gtk</a>;</code></td></tr><tr><td><code>pub extern crate <a class="mod" href="../libnotify/index.html" title="mod libnotify">libnotify</a>;</code></td></tr></table><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class="mod" href="app_state/index.html"
|
||
title='mod pnmixerlib::app_state'>app_state</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Global application state.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="mod" href="ui_entry/index.html"
|
||
title='mod pnmixerlib::ui_entry'>ui_entry</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Global GUI state.</p>
|
||
</td>
|
||
</tr></table><h2 id='macros' class='section-header'><a href="#macros">Macros</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.create_builder_item.html"
|
||
title='macro pnmixerlib::create_builder_item'>create_builder_item</a></td>
|
||
<td class='docblock-short'>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.error_dialog.html"
|
||
title='macro pnmixerlib::error_dialog'>error_dialog</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Present a gtk error dialog with given message.
|
||
Provides only a close button.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.just_warn.html"
|
||
title='macro pnmixerlib::just_warn'>just_warn</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Warns on err and yields <code>()</code> without returning the function.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.pixbuf_new_from_png.html"
|
||
title='macro pnmixerlib::pixbuf_new_from_png'>pixbuf_new_from_png</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Create a pixbuf from the given PNG file. Includes the file as bytes
|
||
in the binary and decodes it.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.push_warning.html"
|
||
title='macro pnmixerlib::push_warning'>push_warning</a></td>
|
||
<td class='docblock-short'>
|
||
<p>If there is an error in the expression, push it to
|
||
the given mutable warning vector.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.result_warn.html"
|
||
title='macro pnmixerlib::result_warn'>result_warn</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Present a gtk error dialog with the error from the <code>Result</code> type,
|
||
if any.
|
||
Provides only a close button.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.try_e.html"
|
||
title='macro pnmixerlib::try_e'>try_e</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Try to unwrap a <code>Result<T, E></code>. If there is a value <code>T</code>, yield it,
|
||
otherwise print an error and exit the program.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.try_r.html"
|
||
title='macro pnmixerlib::try_r'>try_r</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Try to unwrap a <code>Result<T, E></code>. If there is a value <code>T</code>, yield it,
|
||
otherwise return from the function with the given value.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.try_w.html"
|
||
title='macro pnmixerlib::try_w'>try_w</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Try to unwrap a <code>Result<T, E></code>. If there is a value <code>T</code>, yield it,
|
||
otherwise print a warning and <code>return ()</code> from the function.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.try_wr.html"
|
||
title='macro pnmixerlib::try_wr'>try_wr</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Try to unwrap a <code>Result<T, E></code>. If there is a value <code>T</code>, yield it,
|
||
otherwise print a warning and return from the function with the given value.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.unwrap_any.html"
|
||
title='macro pnmixerlib::unwrap_any'>unwrap_any</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Unwraps a <code>Result<T, E></code> by yielding a value of the samet ype
|
||
for either case.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.unwrap_error.html"
|
||
title='macro pnmixerlib::unwrap_error'>unwrap_error</a></td>
|
||
<td class='docblock-short'>
|
||
<p>If there is a value in the Result type, unwrap it, otherwise error-log
|
||
the error, show it via gtk dialog and exit the whole program.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="macro" href="macro.wresult_warn.html"
|
||
title='macro pnmixerlib::wresult_warn'>wresult_warn</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Convert <code>WResult</code> to <code>Result</code>. All warnings are printed via the <code>log</code>
|
||
crate and are shown via Gtk dialogs.</p>
|
||
</td>
|
||
</tr></table></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 = "pnmixerlib";
|
||
</script>
|
||
<script src="../main.js"></script>
|
||
<script defer src="../search-index.js"></script>
|
||
</body>
|
||
</html> |