33 lines
8.5 KiB
HTML
33 lines
8.5 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="`libsw_core` is a comprehensive stopwatch implementation."><title>libsw_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="libsw_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[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="../libsw_core/index.html">libsw_<wbr>core</a><span class="version">0.3.1</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#introduction" title="Introduction">Introduction</a></li><li><a href="#features" title="Features">Features</a><ul><li><a href="#no_std-support" title="`no_std` support"><code>no_std</code> support</a></li><li><a href="#compiler-support" title="Compiler support">Compiler support</a></li><li><a href="#safety" title="Safety">Safety</a></li></ul></li></ul><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>libsw_core</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/libsw_core/lib.rs.html#5-105">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><code>libsw_core</code> is a comprehensive stopwatch implementation.</p>
|
||
<p>It offers <a href="struct.Stopwatch.html#method.checked_stop" title="method libsw_core::Stopwatch::checked_stop">checked stopping</a> and
|
||
<a href="struct.Stopwatch.html#method.checked_add" title="method libsw_core::Stopwatch::checked_add">arithmetic</a>, <a href="struct.Stopwatch.html#method.start_at" title="method libsw_core::Stopwatch::start_at">precise
|
||
control</a> over when operations occur, and supports
|
||
<a href="trait.Instant.html" title="trait libsw_core::Instant">arbitrary timekeeping types</a>.</p>
|
||
<p>If you want to do benchmarking, please use something like
|
||
<a href="https://docs.rs/criterion">Criterion</a>.</p>
|
||
<h2 id="introduction"><a class="doc-anchor" href="#introduction">§</a>Introduction</h2>
|
||
<p><code>libsw_core</code> provides the <a href="struct.Stopwatch.html" title="struct libsw_core::Stopwatch"><code>Stopwatch</code></a> type.</p>
|
||
<p>This implementation is agnostic to the timekeeping type used, by
|
||
virtue of being generic. Any type <code>I</code> that implements the <a href="trait.Instant.html" title="trait libsw_core::Instant"><code>Instant</code></a>
|
||
trait (as in <code>Stopwatch<I></code>) can be used for timekeeping.</p>
|
||
<p><code>Instant</code> is implemented for several timekeeping types out of the box (see
|
||
<a href="#features">features</a>). If present, these
|
||
implementations are exposed as type aliases.</p>
|
||
<h2 id="features"><a class="doc-anchor" href="#features">§</a>Features</h2><div><table><thead><tr><th>Name</th><th>Implies</th><th>Description</th></tr></thead><tbody>
|
||
<tr><td><code>default</code></td><td></td><td>Enabled by default.</td></tr>
|
||
<tr><td><code>std</code></td><td></td><td>Depends on the standard library. Implements <a href="trait.Instant.html" title="trait libsw_core::Instant"><code>Instant</code></a> for <code>std::time::{Instant, SystemTime}</code>. Exposes <code>Sw</code> and <code>SystemSw</code> type aliases.</td></tr>
|
||
<tr><td><code>tokio</code></td><td><code>std</code></td><td>Implements <a href="trait.Instant.html" title="trait libsw_core::Instant"><code>Instant</code></a> for <code>tokio::time::Instant</code>. Exposes <code>TokioSw</code> type alias.</td></tr>
|
||
<tr><td><code>coarsetime</code></td><td><code>std</code></td><td>Implements <a href="trait.Instant.html" title="trait libsw_core::Instant"><code>Instant</code></a> for <code>coarsetime::Instant</code>. Exposes <code>CoarseSw</code> type alias.</td></tr>
|
||
<tr><td><code>quanta</code></td><td><code>std</code></td><td>Implements <a href="trait.Instant.html" title="trait libsw_core::Instant"><code>Instant</code></a> for <code>quanta::Instant</code>. Exposes <code>QuantaSw</code> type alias.</td></tr>
|
||
<tr><td><code>time</code></td><td><code>std</code></td><td>Deprecated. Implements <a href="trait.Instant.html" title="trait libsw_core::Instant"><code>Instant</code></a> for <code>time::Instant</code>. Exposes <code>TimeSw</code> type alias.</td></tr>
|
||
</tbody></table>
|
||
</div><h3 id="no_std-support"><a class="doc-anchor" href="#no_std-support">§</a><code>no_std</code> support</h3>
|
||
<p><code>#![no_std]</code> is set by default.</p>
|
||
<h3 id="compiler-support"><a class="doc-anchor" href="#compiler-support">§</a>Compiler support</h3>
|
||
<p>Standalone, the minimum supported version of Rust is <code>1.61.0</code>.
|
||
Adding dependencies may bump this.</p>
|
||
<h3 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h3>
|
||
<p><code>libsw_core</code> contains no unsafe code (<code>#![forbid(unsafe_code)]</code>).</p>
|
||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Stopwatch.html" title="struct libsw_core::Stopwatch">Stopwatch</a></div><div class="desc docblock-short">A stopwatch measures and accumulates elapsed time between starts and stops.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.Instant.html" title="trait libsw_core::Instant">Instant</a></div><div class="desc docblock-short">A trait outlining the behavior of a timekeeping type.</div></li></ul><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.Sw.html" title="type libsw_core::Sw">Sw</a></div><div class="desc docblock-short">Alias to <a href="struct.Stopwatch.html" title="struct libsw_core::Stopwatch"><code>Stopwatch</code></a> using the standard library’s
|
||
<a href="https://doc.rust-lang.org/1.84.0/std/time/struct.Instant.html" title="struct std::time::Instant"><code>Instant</code></a> type.</div></li><li><div class="item-name"><a class="type" href="type.SystemSw.html" title="type libsw_core::SystemSw">System<wbr>Sw</a></div><div class="desc docblock-short">Alias to <a href="struct.Stopwatch.html" title="struct libsw_core::Stopwatch"><code>Stopwatch</code></a> using the standard library’s
|
||
<a href="https://doc.rust-lang.org/1.84.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime"><code>SystemTime</code></a> type.</div></li></ul></section></div></main></body></html> |