blob: d8c4cc0d2251e66d0ea49ebabf939cbfcea65932 [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="rusty-leveldb is a reimplementation of LevelDB in pure rust. It depends only on a few crates, and is very close to the original, implementation-wise. The external API is relatively small and should be easy to use."><meta name="keywords" content="rust, rustlang, rust-lang, rusty_leveldb"><title>rusty_leveldb - 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="../crates.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 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">&#9776;</button><a class="sidebar-logo" href="../rusty_leveldb/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="../rusty_leveldb/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Crate rusty_leveldb</a></h2><div class="sidebar-elems"><ul class="block"><li class="version">Version 1.0.4</li><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></section></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">Crate <a class="mod" href="#">rusty_leveldb</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/rusty_leveldb/lib.rs.html#1-120">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>rusty-leveldb is a reimplementation of LevelDB in pure rust. It depends only on a few crates,
and is very close to the original, implementation-wise. The external API is relatively small
and should be easy to use.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>rusty_leveldb::{DB, DBIterator, LdbIterator, Options};
<span class="kw">let </span>opt = rusty_leveldb::in_memory();
<span class="kw">let </span><span class="kw-2">mut </span>db = DB::open(<span class="string">&quot;mydatabase&quot;</span>, opt).unwrap();
db.put(<span class="string">b&quot;Hello&quot;</span>, <span class="string">b&quot;World&quot;</span>).unwrap();
<span class="macro">assert_eq!</span>(<span class="string">b&quot;World&quot;</span>, db.get(<span class="string">b&quot;Hello&quot;</span>).unwrap().as_slice());
<span class="kw">let </span><span class="kw-2">mut </span>iter = db.new_iter().unwrap();
<span class="comment">// Note: For efficiency reasons, it&#39;s recommended to use advance() and current() instead of
// next() when iterating over many elements.
</span><span class="macro">assert_eq!</span>((<span class="string">b&quot;Hello&quot;</span>.to_vec(), <span class="string">b&quot;World&quot;</span>.to_vec()), iter.next().unwrap());
db.delete(<span class="string">b&quot;Hello&quot;</span>).unwrap();
db.flush().unwrap();</code></pre></div>
</div></details><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="tests/index.html" title="rusty_leveldb::tests mod">tests</a></div></div></div><h2 id="macros" class="small-section-header"><a href="#macros">Macros</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="macro" href="macro.log.html" title="rusty_leveldb::log macro">log</a></div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.BloomPolicy.html" title="rusty_leveldb::BloomPolicy struct">BloomPolicy</a></div><div class="item-right docblock-short">A filter policy using a bloom filter internally.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.DB.html" title="rusty_leveldb::DB struct">DB</a></div><div class="item-right docblock-short">DB contains the actual database implemenation. As opposed to the original, this implementation
is not concurrent (yet).</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.DBIterator.html" title="rusty_leveldb::DBIterator struct">DBIterator</a></div><div class="item-right docblock-short">DBIterator is an iterator over the contents of a database.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.DefaultCmp.html" title="rusty_leveldb::DefaultCmp struct">DefaultCmp</a></div><div class="item-right docblock-short">The default byte-wise comparator.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.MemEnv.html" title="rusty_leveldb::MemEnv struct">MemEnv</a></div><div class="item-right docblock-short">MemEnv is an in-memory environment that can be used for testing or ephemeral databases. The
performance will be better than what a disk environment delivers.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Options.html" title="rusty_leveldb::Options struct">Options</a></div><div class="item-right docblock-short">Options contains general parameters for a LevelDB instance. Most of the names are
self-explanatory; the defaults are defined in the <code>Default</code> implementation.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.PosixDiskEnv.html" title="rusty_leveldb::PosixDiskEnv struct">PosixDiskEnv</a></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SkipMap.html" title="rusty_leveldb::SkipMap struct">SkipMap</a></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Status.html" title="rusty_leveldb::Status struct">Status</a></div><div class="item-right docblock-short">Status encapsulates a <code>StatusCode</code> and an error message. It can be displayed, and also
implements <code>Error</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.WriteBatch.html" title="rusty_leveldb::WriteBatch struct">WriteBatch</a></div><div class="item-right docblock-short">A WriteBatch contains entries to be written to a MemTable (for example) in a compact form.</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.CompressionType.html" title="rusty_leveldb::CompressionType enum">CompressionType</a></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.StatusCode.html" title="rusty_leveldb::StatusCode enum">StatusCode</a></div><div class="item-right docblock-short">StatusCode describes various failure modes of database operations.</div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Cmp.html" title="rusty_leveldb::Cmp trait">Cmp</a></div><div class="item-right docblock-short">Comparator trait, supporting types that can be nested (i.e., add additional functionality on
top of an inner comparator)</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Env.html" title="rusty_leveldb::Env trait">Env</a></div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.FilterPolicy.html" title="rusty_leveldb::FilterPolicy trait">FilterPolicy</a></div><div class="item-right docblock-short">Encapsulates a filter algorithm allowing to search for keys more efficiently.
Usually, policies are used as a BoxedFilterPolicy (see below), so they
can be easily cloned and nested.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.LdbIterator.html" title="rusty_leveldb::LdbIterator trait">LdbIterator</a></div><div class="item-right docblock-short">An extension of the standard <code>Iterator</code> trait that supports some methods necessary for LevelDB.
This works because the iterators used are stateful and keep the last returned element.</div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.in_memory.html" title="rusty_leveldb::in_memory fn">in_memory</a></div><div class="item-right docblock-short">Returns Options that will cause a database to exist purely in-memory instead of being stored on
disk. This is useful for testing or ephemeral databases.</div></div></div><h2 id="types" class="small-section-header"><a href="#types">Type Definitions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="type" href="type.Result.html" title="rusty_leveldb::Result type">Result</a></div><div class="item-right docblock-short">LevelDB’s result type</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="rusty_leveldb" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>