difftastic/rustdoc/strum_macros/index.html

12 lines
7.9 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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="Strum"><title>strum_macros - 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="strum_macros" 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="../crates.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 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></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../strum_macros/index.html">strum_macros</a><span class="version">0.26.4</span></h2></div><div class="sidebar-elems"><ul class="block">
<li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#derives">Derive Macros</a></li></ul></section></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="../strum_macros/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>Crate <a class="mod" href="#">strum_macros</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/strum_macros/lib.rs.html#1-956">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="strum"><a href="#strum">Strum</a></h2>
<p>Strum is a set of macros and traits for working with
enums and strings easier in Rust.</p>
<p>This crate only contains derive macros for use with the
<a href="https://docs.rs/strum"><code>strum</code></a>
crate. The macros provied by this crate are also available by
enabling the <code>derive</code> feature in aforementioned <code>strum</code> crate.</p>
</div></details><h2 id="derives" class="section-header"><a href="#derives">Derive Macros</a></h2><ul class="item-table"><li><div class="item-name"><a class="derive" href="derive.AsRefStr.html" title="derive strum_macros::AsRefStr">AsRefStr</a></div><div class="desc docblock-short">Converts enum variants to <code>&amp;'a str</code>, where <code>'a</code> is the lifetime of the input enum reference.</div></li><li><div class="item-name"><a class="derive" href="derive.Display.html" title="derive strum_macros::Display">Display</a></div><div class="desc docblock-short">Converts enum variants to strings.</div></li><li><div class="item-name"><a class="derive" href="derive.EnumCount.html" title="derive strum_macros::EnumCount">EnumCount</a></div><div class="desc docblock-short">Add a constant <code>usize</code> equal to the number of variants.</div></li><li><div class="item-name"><a class="derive" href="derive.EnumDiscriminants.html" title="derive strum_macros::EnumDiscriminants">EnumDiscriminants</a></div><div class="desc docblock-short">Generate a new type with only the discriminant names.</div></li><li><div class="item-name"><a class="derive" href="derive.EnumIs.html" title="derive strum_macros::EnumIs">EnumIs</a></div><div class="desc docblock-short">Generated <code>is_*()</code> methods for each variant.
E.g. <code>Color.is_red()</code>.</div></li><li><div class="item-name"><a class="derive" href="derive.EnumIter.html" title="derive strum_macros::EnumIter">EnumIter</a></div><div class="desc docblock-short">Creates a new type that iterates of the variants of an enum.</div></li><li><div class="item-name"><a class="derive" href="derive.EnumMessage.html" title="derive strum_macros::EnumMessage">EnumMessage</a></div><div class="desc docblock-short">Add a verbose message to an enum variant.</div></li><li><div class="item-name"><a class="derive" href="derive.EnumProperty.html" title="derive strum_macros::EnumProperty">EnumProperty</a></div><div class="desc docblock-short">Add custom properties to enum variants.</div></li><li><div class="item-name"><a class="derive" href="derive.EnumString.html" title="derive strum_macros::EnumString">EnumString</a></div><div class="desc docblock-short">Converts strings to enum variants based on their name.</div></li><li><div class="item-name"><a class="derive" href="derive.EnumTryAs.html" title="derive strum_macros::EnumTryAs">EnumTryAs</a></div><div class="desc docblock-short">Generated <code>try_as_*()</code> methods for all tuple-style variants.
E.g. <code>Message.try_as_write()</code>.</div></li><li><div class="item-name"><a class="derive" href="derive.FromRepr.html" title="derive strum_macros::FromRepr">FromRepr</a></div><div class="desc docblock-short">Add a function to enum that allows accessing variants by its discriminant</div></li><li><div class="item-name"><a class="derive" href="derive.IntoStaticStr.html" title="derive strum_macros::IntoStaticStr">IntoStaticStr</a></div><div class="desc docblock-short">Implements <code>From&lt;MyEnum&gt; for &amp;'static str</code> on an enum.</div></li><li><div class="item-name"><a class="derive" href="derive.VariantArray.html" title="derive strum_macros::VariantArray">VariantArray</a></div><div class="desc docblock-short">Adds a <code>'static</code> slice with all of the Enums variants.</div></li><li><div class="item-name"><a class="derive" href="derive.VariantNames.html" title="derive strum_macros::VariantNames">VariantNames</a></div><div class="desc docblock-short">Implements <code>Strum::VariantNames</code> which adds an associated constant <code>VARIANTS</code> which is a <code>'static</code> slice of discriminant names.</div></li></ul></section></div></main></body></html>