<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="This trait represents either a `Table`, or an `InlineTable`."><title>TableLike in toml_edit - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../static.files/rustdoc-5bc39a1768837dd0.css"><metaname="rustdoc-vars"data-root-path="../"data-static-root-path="../static.files/"data-current-crate="toml_edit"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"><scriptsrc="../static.files/storage-4c98445ec4002617.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../static.files/main-48f368f3872407c8.js"></script><noscript><linkrel="stylesheet"href="../static.files/noscript-04d5337699b92874.css"></noscript><linkrel="alternate icon"type="image/png"href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><linkrel="alternate icon"type="image/png"href="../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle"title="show sidebar"></button></nav><navclass="sidebar"><divclass="sidebar-crate"><h2><ahref="../toml_edit/index.html">toml_edit</a><spanclass="version">0.22.9</span></h2></div><h2class="location"><ahref="#">TableLike</a></h2><divclass="sidebar-elems"><section><h3><ahref="#required-methods">Required Methods</a></h3><ulclass="block"><li><ahref="#tymethod.clear">clear</a></li><li><ahref="#tymethod.contains_key">contains_key</a></li><li><ahref="#tymethod.entry">entry</a></li><li><ahref="#tymethod.entry_format">entry_format</a></li><li><ahref="#tymethod.fmt">fmt</a></li><li><ahref="#tymethod.get">get</a></li><li><ahref="#tymethod.get_key_value">get_key_value</a></li><li><ahref="#tymethod.get_key_value_mut">get_key_value_mut</a></li><li><ahref="#tymethod.get_mut">get_mut</a></li><li><ahref="#tymethod.get_values">get_values</a></li><li><ahref="#tymethod.insert">insert</a></li><li><ahref="#tymethod.is_dotted">is_dotted</a></li><li><ahref="#tymethod.iter">iter</a></li><li><ahref="#tymethod.iter_mut">iter_mut</a></li><li><ahref="#tymethod.key">key</a></li><li><ahref="#tymethod.key_decor">key_decor</a></li><li><ahref="#tymethod.key_decor_mut">key_decor_mut</a></li><li><ahref="#tymethod.key_mut">key_mut</a></li><li><ahref="#tymethod.remove">remove</a></li><li><ahref="#tymethod.set_dotted">set_dotted</a></li><li><ahref="#tymethod.sort_values">sort_values</a></li></ul><h3><ahref="#provided-methods">Provided Methods</a></h3><ulclass="block"><li><ahref="#method.is_empty">is_empty</a></li><li><ahref="#method.len">len</a></li></ul><h3><ahref="#implementors">Implementors</a></h3></section><h2><ahref="index.html">In crate toml_edit</a></h2></div></nav><divclass="sidebar-resizer"></div>
<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../toml_edit/all.html"title="show sidebar"></a></div><inputclass="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"><divid="help-button"tabindex="-1"><ahref="../help.html"title="help">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1>Trait <ahref="index.html">toml_edit</a>::<wbr><aclass="trait"href="#">TableLike</a><buttonid="copy-path"title="Copy item path to clipboard"><imgsrc="../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="src"href="../src/toml_edit/table.rs.html#531-591">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><preclass="rust item-decl"><code>pub trait TableLike: Sealed {
</details>}</code></pre><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>This trait represents either a <code>Table</code>, or an <code>InlineTable</code>.</p>
</div></details><h2id="required-methods"class="section-header">Required Methods<ahref="#required-methods"class="anchor">§</a></h2><divclass="methods"><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.iter"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#533">source</a><h4class="code-header">fn <ahref="#tymethod.iter"class="fn">iter</a>(&self) -><aclass="type"href="type.Iter.html"title="type toml_edit::Iter">Iter</a><'_></h4></section></summary><divclass="docblock"><p>Returns an iterator over key/value pairs.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.iter_mut"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#535">source</a><h4class="code-header">fn <ahref="#tymethod.iter_mut"class="fn">iter_mut</a>(&mut self) -><aclass="type"href="type.IterMut.html"title="type toml_edit::IterMut">IterMut</a><'_></h4></section></summary><divclass="docblock"><p>Returns an mutable iterator over all key/value pairs, including empty.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.clear"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#545">source</a><h4class="code-header">fn <ahref="#tymethod.clear"class="fn">clear</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Clears the table, removing all key-value pairs. Keeps the allocated memory for reuse.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.entry"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#547">source</a><h4class="code-header">fn <ahref="#tymethod.entry"class="fn">entry</a><'a>(&'a mut self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="enum"href="enum.Entry.html"title="enum toml_edit::Entry">Entry</a><'a></h4></section></summary><divclass="docblock"><p>Gets the given key’s corresponding entry in the Table for in-place manipulation.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.entry_format"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#549">source</a><h4class="code-header">fn <ahref="#tymethod.entry_format"class="fn">entry_format</a><'a>(&'a mut self, key: &<aclass="struct"href="struct.Key.html"title="struct toml_edit::Key">Key</a>) -><aclass="enum"href="enum.Entry.html"title="enum toml_edit::Entry">Entry</a><'a></h4></section></summary><divclass="docblock"><p>Gets the given key’s corresponding entry in the Table for in-place manipulation.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.get"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#551">source</a><h4class="code-header">fn <ahref="#tymethod.get"class="fn">get</a><'s>(&'s self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&'s <aclass="enum"href="enum.Item.html"title="enum toml_edit::Item">Item</a>></h4></section></summary><divclass="docblock"><p>Returns an optional reference to an item given the key.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.get_mut"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#553">source</a><h4class="code-header">fn <ahref="#tymethod.get_mut"class="fn">get_mut</a><'s>(&'s mut self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&'s mut <aclass="enum"href="enum.Item.html"title="enum toml_edit::Item">Item</a>></h4></section></summary><divclass="docblock"><p>Returns an optional mutable reference to an item given the key.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.get_key_value"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#555">source</a><h4class="code-header">fn <ahref="#tymethod.get_key_value"class="fn">get_key_value</a><'a>(&'a self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><(&'a <aclass="struct"href="struct.Key.html"title="struct toml_edit::Key">Key</a>, &'a <aclass="enum"href="enum.Item.html"title="enum toml_edit::Item">Item</a>)></h4></section></summary><divclass="docblock"><p>Return references to the key-value pair stored for key, if it is present, else None.</p>
) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><(<aclass="struct"href="struct.KeyMut.html"title="struct toml_edit::KeyMut">KeyMut</a><'a>, &'a mut <aclass="enum"href="enum.Item.html"title="enum toml_edit::Item">Item</a>)></h4></section></summary><divclass="docblock"><p>Return mutable references to the key-value pair stored for key, if it is present, else None.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.contains_key"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#559">source</a><h4class="code-header">fn <ahref="#tymethod.contains_key"class="fn">contains_key</a>(&self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns true if the table contains an item with the given key.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.insert"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#561">source</a><h4class="code-header">fn <ahref="#tymethod.insert"class="fn">insert</a>(&mut self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>, value: <aclass="enum"href="enum.Item.html"title="enum toml_edit::Item">Item</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="enum"href="enum.Item.html"title="enum toml_edit::Item">Item</a>></h4></section></summary><divclass="docblock"><p>Inserts a key-value pair into the map.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.remove"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#563">source</a><h4class="code-header">fn <ahref="#tymethod.remove"class="fn">remove</a>(&mut self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="enum"href="enum.Item.html"title="enum toml_edit::Item">Item</a>></h4></section></summary><divclass="docblock"><p>Removes an item given the key.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.get_values"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#568">source</a><h4class="code-header">fn <ahref="#tymethod.get_values"class="fn">get_values</a>(&self) -><aclass="struct"href="https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html"title="struct alloc::vec::Vec">Vec</a><(<aclass="struct"href="https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html"title="struct alloc::vec::Vec">Vec</a><&<aclass="struct"href="struct.Key.html"title="struct toml_edit::Key">Key</a>>, &<aclass="enum"href="enum.Value.html"title="enum toml_edit::Value">Value</a>)></h4></section></summary><divclass="docblock"><p>Get key/values for values that are visually children of this table</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.fmt"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#571">source</a><h4class="code-header">fn <ahref="#tymethod.fmt"class="fn">fmt</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Auto formats the table.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.sort_values"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#575">source</a><h4class="code-header">fn <ahref="#tymethod.sort_values"class="fn">sort_values</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Sorts Key/Value Pairs of the table.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.is_dotted"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#579">source</a><h4class="code-header">fn <ahref="#tymethod.is_dotted"class="fn">is_dotted</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Check if this is a wrapper for dotted keys, rather than a standard table</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.key"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#582">source</a><h4class="code-header">fn <ahref="#tymethod.key"class="fn">key</a>(&self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&<aclass="struct"href="struct.Key.html"title="struct toml_edit::Key">Key</a>></h4></section></summary><divclass="docblock"><p>Returns an accessor to a key’s formatting</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.key_mut"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#584">source</a><h4class="code-header">fn <ahref="#tymethod.key_mut"class="fn">key_mut</a>(&mut self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.KeyMut.html"title="struct toml_edit::KeyMut">KeyMut</a><'_>></h4></section></summary><divclass="docblock"><p>Returns an accessor to a key’s formatting</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.key_decor_mut"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#587">source</a><h4class="code-header">fn <ahref="#tymethod.key_decor_mut"class="fn">key_decor_mut</a>(&mut self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&mut <aclass="struct"href="struct.Decor.html"title="struct toml_edit::Decor">Decor</a>></h4></section></summary><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 0.21.1: Replaced with <code>key_mut</code></span></div></span><divclass="docblock"><p>Returns the decor associated with a given key of the table.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="tymethod.key_decor"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#590">source</a><h4class="code-header">fn <ahref="#tymethod.key_decor"class="fn">key_decor</a>(&self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&<aclass="struct"href="struct.Decor.html"title="struct toml_edit::Decor">Decor</a>></h4></section></summary><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 0.21.1: Replaced with <code>key_mut</code></span></div></span><divclass="docblock"><p>Returns the decor associated with a given key of the table.</p>
</div></details></div><h2id="provided-methods"class="section-header">Provided Methods<ahref="#provided-methods"class="anchor">§</a></h2><divclass="methods"><detailsclass="toggle method-toggle"open><summary><sectionid="method.len"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#537-539">source</a><h4class="code-header">fn <ahref="#method.len"class="fn">len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the number of nonempty items.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_empty"class="method"><aclass="src rightside"href="../src/toml_edit/table.rs.html#541-543">source</a><h4class="code-header">fn <ahref="#method.is_empty"class="fn">is_empty</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns true if the table is empty.</p>
</div></details></div><h2id="implementors"class="section-header">Implementors<ahref="#implementors"class="anchor">§</a></h2><divid="implementors-list"><sectionid="impl-TableLike-for-InlineTable"class="impl"><aclass="src rightside"href="../src/toml_edit/inline_table.rs.html#507-597">source</a><ahref="#impl-TableLike-for-InlineTable"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="trait.TableLike.html"title="trait toml_edit::TableLike">TableLike</a> for <aclass="struct"href="struct.InlineTable.html"title="struct toml_edit::InlineTable">InlineTable</a></h3></section><sectionid="impl-TableLike-for-Table"class="impl"><aclass="src rightside"href="../src/toml_edit/table.rs.html#593-661">source</a><ahref="#impl-TableLike-for-Table"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="trait.TableLike.html"title="trait toml_edit::TableLike">TableLike</a> for <aclass="struct"href="struct.Table.html"title="struct toml_edit::Table">Table</a></h3></section></div><scriptsrc="../trait.impl/toml_edit/table/trait.TableLike.js"async></script></section></div></main></body></html>