<!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><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><linkrel="stylesheet"href="../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../static.files/rustdoc-dd39b87e5fcfba68.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.80.0 (051478957 2024-07-21)"data-channel="1.80.0"data-search-js="search-d52510db62a78183.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../static.files/storage-118b08c4c78b968e.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../static.files/main-20a3ad099b048cf2.js"></script><noscript><linkrel="stylesheet"href="../static.files/noscript-df360f571f6edeae.css"></noscript><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.20</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"><rustdoc-search></rustdoc-search><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">Copy item path</button></h1><spanclass="out-of-band"><aclass="src"href="../src/toml_edit/table.rs.html#532-592">source</a> · <buttonid="
</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#534">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#536">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#546">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#548">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.80.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#550">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#552">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.80.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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#554">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.80.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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#556">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.80.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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.80.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#560">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.80.0/std/primitive.str.html">str</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.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#562">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.80.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.80.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#564">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.80.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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#569">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.80.0/alloc/vec/struct.Vec.html"title="struct alloc::vec::Vec">Vec</a><(<aclass="struct"href="https://doc.rust-lang.org/1.80.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#572">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#576">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#580">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.80.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#583">source</a><h4class="code-header">fn <ahref="#tymethod.key"class="fn">key</a>(&self, key: &<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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#585">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.80.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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#588">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.80.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 0.21.1: Replaced with <code>key_mut</code></span></div></span></summary><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#591">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.80.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 0.21.1: Replaced with <code>key_mut</code></span></div></span></summary><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#538-540">source</a><h4class="code-header">fn <ahref="#method.len"class="fn">len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.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#542-544">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.80.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#594-662">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>