mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 06:15:45 +01:00
41 lines
No EOL
5.7 KiB
HTML
41 lines
No EOL
5.7 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="Generates a `fmt::Debug` implementation."><title>bitfield_debug in bitfield - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.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"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bitfield" data-themes="" data-resource-suffix="" data-rustdoc-version="1.91.1 (ed61e7d7e 2025-11-07)" data-channel="1.91.1" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-c3e638e9.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-6dc2a7f3.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc macro"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">bitfield_debug</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../bitfield/index.html">bitfield</a><span class="version">0.13.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">bitfield_<wbr>debug</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate bitfield</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">bitfield</a></div><h1>Macro <span class="macro">bitfield_<wbr>debug</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/bitfield/lib.rs.html#278-323">Source</a> </span></div><pre class="rust item-decl"><code>macro_rules! bitfield_debug {
|
|
(struct $name:ident; $($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, #[$attribute:meta] $($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, pub $($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, _, $setter:tt: $($exprs:expr),*; $($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, $type:ty; $($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, $getter:ident, $setter:tt: $msb:expr, $lsb:expr, $count:expr;
|
|
$($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, $getter:ident, $setter:tt: $($exprs:expr),*; $($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, from into $into:ty, $($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, into $into:ty, $($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, $type:ty, $($rest:tt)*) => { ... };
|
|
($debug_struct:ident, $self:ident, ) => { ... };
|
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Generates a <code>fmt::Debug</code> implementation.</p>
|
|
<p>This macros must be called from a <code>impl Debug for ...</code> block. It will generate the <code>fmt</code> method.</p>
|
|
<p>In most of the case, you will not directly call this macros, but use <code>bitfield</code>.</p>
|
|
<p>The syntax is <code>struct TheNameOfTheStruct</code> followed by the syntax of <code>bitfield_fields</code>.</p>
|
|
<p>The write-only fields are ignored.</p>
|
|
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">struct </span>FooBar(u32);
|
|
<span class="macro">bitfield_bitrange!</span>{<span class="kw">struct </span>FooBar(u32)}
|
|
<span class="kw">impl </span>FooBar{
|
|
<span class="macro">bitfield_fields!</span>{
|
|
u32;
|
|
field1, <span class="kw">_</span>: <span class="number">7</span>, <span class="number">0</span>;
|
|
field2, <span class="kw">_</span>: <span class="number">31</span>, <span class="number">24</span>;
|
|
}
|
|
}
|
|
|
|
<span class="kw">impl </span>std::fmt::Debug <span class="kw">for </span>FooBar {
|
|
<span class="macro">bitfield_debug!</span>{
|
|
<span class="kw">struct </span>FooBar;
|
|
field1, <span class="kw">_</span>: <span class="number">7</span>, <span class="number">0</span>;
|
|
field2, <span class="kw">_</span>: <span class="number">31</span>, <span class="number">24</span>;
|
|
}
|
|
}
|
|
|
|
<span class="kw">fn </span>main() {
|
|
<span class="kw">let </span>foobar = FooBar(<span class="number">0x11223344</span>);
|
|
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, foobar);
|
|
}</code></pre></div></div></details></section></div></main></body></html> |