edlang/gimli/read/trait.Section.html

46 lines
26 KiB
HTML
Raw Normal View History

<!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="A convenience trait for loading DWARF sections from object files. To be used like:"><title>Section in gimli::read - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="gimli" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc trait"><!--[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></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../gimli/index.html">gimli</a><span class="version">0.28.1</span></h2></div><h2 class="location"><a href="#">Section</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.id">id</a></li><li><a href="#tymethod.reader">reader</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.dwo_section_name">dwo_section_name</a></li><li><a href="#method.dwp_range">dwp_range</a></li><li><a href="#method.load">load</a></li><li><a href="#method.lookup_offset_id">lookup_offset_id</a></li><li><a href="#method.section_name">section_name</a></li><li><a href="#method.xcoff_section_name">xcoff_section_name</a></li></ul><h3><a href="#object-safety">Object Safety</a></h3><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In gimli::read</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../gimli/all.html" title="show sidebar"></a></div><input class="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"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="../index.html">gimli</a>::<wbr><a href="index.html">read</a>::<wbr><a class="trait" href="#">Section</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/gimli/read/mod.rs.html#612-667">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub trait Section&lt;R&gt;: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;R&gt; {
// Required methods
fn <a href="#tymethod.id" class="fn">id</a>() -&gt; <a class="enum" href="../enum.SectionId.html" title="enum gimli::SectionId">SectionId</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.reader" class="fn">reader</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.reference.html">&amp;R</a>
<span class="where">where R: <a class="trait" href="trait.Reader.html" title="trait gimli::read::Reader">Reader</a></span>;
// Provided methods
fn <a href="#method.section_name" class="fn">section_name</a>() -&gt; &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.str.html">str</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.dwo_section_name" class="fn">dwo_section_name</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.str.html">str</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.xcoff_section_name" class="fn">xcoff_section_name</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.str.html">str</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.load" class="fn">load</a>&lt;F, E&gt;(f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, E&gt;
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="enum" href="../enum.SectionId.html" title="enum gimli::SectionId">SectionId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;R, E&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.dwp_range" class="fn">dwp_range</a>(&amp;self, offset: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u32.html">u32</a>, size: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u32.html">u32</a>) -&gt; <a class="type" href="type.Result.html" title="type gimli::read::Result">Result</a>&lt;Self&gt;
<span class="where">where R: <a class="trait" href="trait.Reader.html" title="trait gimli::read::Reader">Reader</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.lookup_offset_id" class="fn">lookup_offset_id</a>(
&amp;self,
id: <a class="struct" href="struct.ReaderOffsetId.html" title="struct gimli::read::ReaderOffsetId">ReaderOffsetId</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="enum" href="../enum.SectionId.html" title="enum gimli::SectionId">SectionId</a>, R::<a class="associatedtype" href="trait.Reader.html#associatedtype.Offset" title="type gimli::read::Reader::Offset">Offset</a>)&gt;
<span class="where">where R: <a class="trait" href="trait.Reader.html" title="trait gimli::read::Reader">Reader</a></span> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A convenience trait for loading DWARF sections from object files. To be
used like:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>gimli::{DebugInfo, EndianSlice, LittleEndian, Reader, Section};
<span class="kw">let </span>buf = [<span class="number">0x00</span>, <span class="number">0x01</span>, <span class="number">0x02</span>, <span class="number">0x03</span>];
<span class="kw">let </span>reader = EndianSlice::new(<span class="kw-2">&amp;</span>buf, LittleEndian);
<span class="kw">let </span>loader = |name| -&gt; <span class="prelude-ty">Result</span>&lt;<span class="kw">_</span>, ()&gt; { <span class="prelude-val">Ok</span>(reader) };
<span class="kw">let </span>debug_info: DebugInfo&lt;<span class="kw">_</span>&gt; = Section::load(loader).unwrap();</code></pre></div>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.id" class="method"><a class="src rightside" href="../../src/gimli/read/mod.rs.html#614">source</a><h4 class="code-header">fn <a href="#tymethod.id" class="fn">id</a>() -&gt; <a class="enum" href="../enum.SectionId.html" title="enum gimli::SectionId">SectionId</a></h4></section></summary><div class="docblock"><p>Returns the section id for this type.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.reader" class="method"><a class="src rightside" href="../../src/gimli/read/mod.rs.html#642-644">source</a><h4 class="code-header">fn <a href="#tymethod.reader" class="fn">reader</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.reference.html">&amp;R</a><div class="where">where
R: <a class="trait" href="trait.Reader.html" title="trait gimli::read::Reader">Reader</a>,</div></h4></section></summary><div class="docblock"><p>Returns the <code>Reader</code> for this section.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.section_name" class="method"><a class="src rightside" href="../../src/gimli/read/mod.rs.html#617-619">source</a><h4 class="code-header">fn <a href="#method.section_name" class="fn">section_name</a>() -&gt; &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.str.html">str</a></h4></section></summary><div class="docblock"><p>Returns the ELF section name for this type.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.dwo_section_name" class="method"><a class="src rightside" href="../../src/gimli/read/mod.rs.html#623-625">source</a><h4 class="code-header">fn <a href="#method.dwo_section_name" class="fn">dwo_section_name</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the ELF section name (if any) for this type when used in a dwo
file.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.xcoff_section_name" class="method"><a class="src rightside" href="../../src/gimli/read/mod.rs.html#629-631">source</a><h4 class="code-header">fn <a href="#method.xcoff_section_name" class="fn">xcoff_section_name</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the XCOFF section name (if any) for this type when used in a XCOFF
file.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.load" class="method"><a class="src rightside" href="../../src/gimli/read/mod.rs.html#634-639">source</a><h4 class="code-header">fn <a href="#method.load" class="fn">load</a>&lt;F, E&gt;(f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, E&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="enum" href="../enum.SectionId.html" title="enum gimli::SectionId">SectionId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;R, E&gt;,</div></h4></section></summary><div class="docblock"><p>Try to load the section using the given loader function.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.dwp_range" class="method"><a class="src rightside" href="../../src/gimli/read/mod.rs.html#648-656">source</a><h4 class="code-header">fn <a href="#method.dwp_range" class="fn">dwp_range</a>(&amp;self, offset: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u32.html">u32</a>, size: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u32.html">u32</a>) -&gt; <a class="type" href="type.Result.html" title="type gimli::read::Result">Result</a>&lt;Self&gt;<div class="where">where
R: <a class="trait" href="trait.Reader.html" title="trait gimli::read::Reader">Reader</a>,</div></h4></section></summary><div class="docblock"><p>Returns the subrange of the section that is the contribution of
a unit in a <code>.dwp</code> file.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.lookup_offset_id" class="method"><a class="src rightside" href="../../src/gimli/read/mod.rs.html#659-666">source</a><h4 class="code-header">fn <a href="#method.lookup_offset_id" class="fn">lookup_offset_id</a>(&amp;self, id: <a class="struct" href="struct.ReaderOffsetId.html" title="struct gimli::read::ReaderOffsetId">ReaderOffsetId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="enum" href="../enum.SectionId.html" title="enum gimli::SectionId">SectionId</a>, R::<a class="associatedtype" href="trait.Reader.html#associatedtype.Offset" title="type gimli::read::Reader::Offset">Offset</a>)&gt;<div class="where">where
R: <a class="trait" href="trait.Reader.html" title="trait gimli::read::Reader">Reader</a>,</div></h4></section></summary><div class="docblock"><p>Returns the <code>Reader</code> for this section.</p>
</div></details></div><h2 id="object-safety" class="section-header">Object Safety<a href="#object-safety" class="anchor">§</a></h2><div class="object-safety-info">This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.76.0/reference/items/traits.html#object-safety">object safe</a>.</div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Section%3CR%3E-for-DebugAbbrev%3CR%3E" class="impl"><a class="src rightside" href="../../src/gimli/read/abbrev.rs.html#88-96">source</a><a href="#impl-Section%3CR%3E-for-DebugAbbrev%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R&gt; <a class="trait" href="trait.Section.html" title="trait gimli::read::Section">Section</a>&lt;R&gt; for <a class="struct" href="struct.DebugAbbrev.html" title="struct gimli::read::DebugAbbrev">DebugAbbrev</a>&lt;R&gt;</h3></section><section id="impl-Section%3CR%3E-for-DebugAddr%3CR%3E" class="impl"><a class="src rightside" href="../../src/gimli/read/addr.rs.html#67-75">source</a><a href="#impl-Section%3CR%3E-for-DebugAddr%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R&gt; <a class="trait" href="trait.Section.html" title="trait gimli::read::Section">Section</a>&lt;R&gt; for <a class="struct" href="struct.DebugAddr.html" title="struct gimli::read::DebugAddr">DebugAddr</a>&lt;R&gt;</h3></section><section id="impl-Section%3CR%3E-for-DebugAranges%3CR%3E" class="impl"><a class="src rightside" href="../../src/gimli/read/aranges.rs.html#81-89">source</a><a href="#impl-Section%3CR%3E-for-DebugAranges%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R&gt; <a class="trait" href="trait.Section.html" title="trait gimli::read::Section">Section</a>&lt;R&gt; for <a class="struct" href="struct.DebugAranges.html" title="struct gimli::read::DebugAranges">DebugAranges</a>&lt;R&gt;</h3></section><section id="impl-Section%3CR%3E-for-DebugCuIndex%3CR%3E" class="impl"><a class="src rightside" href="../../src/gimli/read/index.rs.html#27-35">source</a><a href="#impl-Section%3CR%3E-for-DebugCuIndex%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R&gt; <a class="trait" href="trait.Section.html" title="trait gimli::read::Section">Section</a>&lt;R&gt; for <a class="struct" href="struct.DebugCuIndex.html" title="struct gimli::read::DebugCuIndex">DebugCuIndex</a>&lt;R&gt;</h3></section><section id="impl-Section%3CR%3E-for-DebugInfo%3CR%3E" class="impl"><a class="src rightside" href="../../src/gimli/read/unit.rs.html#169-177">source</a><a href="#impl-Section%3CR%3E-for-DebugInfo%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R&gt; <a class="trait" href="trait.Section.html" title="trait gimli::read::Section">Section</a>&lt;R&gt; for <a class="struct" href="struct.DebugInfo.html" title="struct gimli::read::DebugInfo">DebugInfo</a>&lt;R&gt;</h3></section><section id="impl-Section%3CR%3E-for-DebugLine%3CR%3E" class="impl"><a class="src rightside" href="../../src/gimli/read/line.rs.html#108-116">source</a><a href="#impl-Section%3CR%3E-for-DebugLine%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R&gt; <a class="trait" href="trait.Section.html" title="trait gimli::read::Section">Section</a>&lt;R&gt; for <a class="struct" href="struct.DebugLine.html" title="struct gimli::read::DebugLine">DebugLine</a>&lt;R&gt;</h3></section><section id="impl-Section%3CR%3E-for-DebugLineStr%3CR%3E" class="impl"><a class="src rightside" href="../../src/gimli/read/str.rs.html#264-272">source</a><a href="#impl-Section%3CR%3E-for-DebugLineStr%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R&gt; <a class="trait" href="trait.Section.html" title="trait gimli::read::Section">Section</a>&lt;R&gt; for <a class="struct" href="struct.DebugLineStr.html" title="struct gimli::read::DebugLineStr">DebugLineStr</a>&lt;R&gt;</h3></section><section id="impl-Section%3CR%3E-for-DebugLoc%3CR%3E" class="impl"><a class="src rightside" href="../../src/gimli/read/loclists.rs.html#41-49">source</a><a href="#impl-Section%3CR%3E-for-DebugLoc%