mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-23 00:18:24 +00:00
deploy: 3872c0128b
This commit is contained in:
parent
40d6b42902
commit
5ccc45de45
|
@ -1 +1 @@
|
||||||
window.ALL_CRATES = ["addr2line","adler","anstream","anstyle","anstyle_parse","anstyle_query","ariadne","backtrace","beef","bitflags","cfg_if","clap","clap_builder","clap_derive","clap_lex","color_eyre","color_spantrace","colorchoice","concolor","concolor_query","edlang","edlang_ast","edlang_check","edlang_codegen_llvm","edlang_driver","edlang_ir","edlang_lowering","edlang_parser","edlang_session","edlang_span","either","eyre","fnv","gimli","heck","indenter","inkwell","inkwell_internals","is_terminal","itertools","lalrpop_util","lazy_static","libc","llvm_sys","log","logos","logos_codegen","logos_derive","matchers","memchr","miniz_oxide","nu_ansi_term","object","once_cell","overload","owo_colors","pin_project_lite","proc_macro2","quote","regex","regex_automata","regex_syntax","rustc_demangle","sharded_slab","smallvec","strsim","syn","thiserror","thiserror_impl","thread_local","tracing","tracing_attributes","tracing_core","tracing_error","tracing_log","tracing_subscriber","unicode_ident","unicode_width","utf8parse","yansi"];
|
window.ALL_CRATES = ["addr2line","adler","anstream","anstyle","anstyle_parse","anstyle_query","ariadne","backtrace","beef","bitflags","cfg_if","clap","clap_builder","clap_derive","clap_lex","color_eyre","color_spantrace","colorchoice","concolor","concolor_query","edlang","edlang_ast","edlang_check","edlang_codegen_llvm","edlang_driver","edlang_ir","edlang_lowering","edlang_parser","edlang_session","edlang_span","educe","either","enum_ordinalize","enum_ordinalize_derive","eyre","fnv","gimli","heck","indenter","inkwell","inkwell_internals","is_terminal","itertools","lalrpop_util","lazy_static","libc","llvm_sys","log","logos","logos_codegen","logos_derive","matchers","memchr","miniz_oxide","nu_ansi_term","object","once_cell","overload","owo_colors","pin_project_lite","proc_macro2","quote","regex","regex_automata","regex_syntax","rustc_demangle","sharded_slab","smallvec","strsim","syn","thiserror","thiserror_impl","thread_local","tracing","tracing_attributes","tracing_core","tracing_error","tracing_log","tracing_subscriber","unicode_ident","unicode_width","utf8parse","yansi"];
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
||||||
<!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="API documentation for the Rust `codegen` mod in crate `edlang_codegen_llvm`."><title>edlang_codegen_llvm::codegen - 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="edlang_codegen_llvm" 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 mod"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../edlang_codegen_llvm/index.html">edlang_codegen_llvm</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">Module codegen</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#functions">Functions</a></li></ul></section><h2><a href="../index.html">In crate edlang_codegen_llvm</a></h2></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `codegen` mod in crate `edlang_codegen_llvm`."><title>edlang_codegen_llvm::codegen - 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="edlang_codegen_llvm" 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 mod"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../edlang_codegen_llvm/index.html">edlang_codegen_llvm</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">Module codegen</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#functions">Functions</a></li></ul></section><h2><a href="../index.html">In crate edlang_codegen_llvm</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="../../edlang_codegen_llvm/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>Module <a href="../index.html">edlang_codegen_llvm</a>::<wbr><a class="mod" href="#">codegen</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/edlang_codegen_llvm/codegen.rs.html#1-1410">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.compile.html" title="fn edlang_codegen_llvm::codegen::compile">compile</a></div></li></ul></section></div></main></body></html>
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../edlang_codegen_llvm/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>Module <a href="../index.html">edlang_codegen_llvm</a>::<wbr><a class="mod" href="#">codegen</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/edlang_codegen_llvm/codegen.rs.html#1-1413">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.compile.html" title="fn edlang_codegen_llvm::codegen::compile">compile</a></div></li></ul></section></div></main></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
<!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="API documentation for the Rust `lower_type` fn in crate `edlang_lowering`."><title>lower_type in edlang_lowering - 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="edlang_lowering" 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 fn"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../edlang_lowering/index.html">edlang_lowering</a><span class="version">0.0.1-alpha.10</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `lower_type` fn in crate `edlang_lowering`."><title>lower_type in edlang_lowering - 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="edlang_lowering" 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 fn"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../edlang_lowering/index.html">edlang_lowering</a><span class="version">0.0.1-alpha.10</span></h2></div><div class="sidebar-elems"></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="../edlang_lowering/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>Function <a href="index.html">edlang_lowering</a>::<wbr><a class="fn" href="#">lower_type</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/edlang_lowering/lib.rs.html#1139-1233">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn lower_type(
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../edlang_lowering/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>Function <a href="index.html">edlang_lowering</a>::<wbr><a class="fn" href="#">lower_type</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/edlang_lowering/lib.rs.html#1144-1238">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn lower_type(
|
||||||
ctx: &BuildCtx,
|
ctx: &BuildCtx,
|
||||||
t: &<a class="struct" href="../edlang_ast/struct.Type.html" title="struct edlang_ast::Type">Type</a>,
|
t: &<a class="struct" href="../edlang_ast/struct.Type.html" title="struct edlang_ast::Type">Type</a>,
|
||||||
module_id: <a class="struct" href="../edlang_ir/struct.DefId.html" title="struct edlang_ir::DefId">DefId</a>
|
module_id: <a class="struct" href="../edlang_ir/struct.DefId.html" title="struct edlang_ir::DefId">DefId</a>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<!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="API documentation for the Rust `edlang_lowering` crate."><title>edlang_lowering - 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="edlang_lowering" 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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../edlang_lowering/index.html">edlang_lowering</a><span class="version">0.0.1-alpha.10</span></h2></div><div class="sidebar-elems"><ul class="block">
|
<!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="API documentation for the Rust `edlang_lowering` crate."><title>edlang_lowering - 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="edlang_lowering" 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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../edlang_lowering/index.html">edlang_lowering</a><span class="version">0.0.1-alpha.10</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="#modules">Modules</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><div class="sidebar-resizer"></div>
|
<li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#functions">Functions</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="../edlang_lowering/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="#">edlang_lowering</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/edlang_lowering/lib.rs.html#1-1233">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="errors/index.html" title="mod edlang_lowering::errors">errors</a></div></li></ul><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.lower_modules.html" title="fn edlang_lowering::lower_modules">lower_modules</a></div></li><li><div class="item-name"><a class="fn" href="fn.lower_type.html" title="fn edlang_lowering::lower_type">lower_type</a></div></li></ul></section></div></main></body></html>
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../edlang_lowering/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="#">edlang_lowering</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/edlang_lowering/lib.rs.html#1-1238">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="errors/index.html" title="mod edlang_lowering::errors">errors</a></div></li></ul><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.lower_modules.html" title="fn edlang_lowering::lower_modules">lower_modules</a></div></li><li><div class="item-name"><a class="fn" href="fn.lower_type.html" title="fn edlang_lowering::lower_type">lower_type</a></div></li></ul></section></div></main></body></html>
|
|
@ -1,5 +1,5 @@
|
||||||
<!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="API documentation for the Rust `BinaryFirstLvlOpParser` struct in crate `edlang_parser`."><title>BinaryFirstLvlOpParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">BinaryFirstLvlOpParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-BinaryFirstLvlOpParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BinaryFirstLvlOpParser">Send</a></li><li><a href="#impl-Sync-for-BinaryFirstLvlOpParser">Sync</a></li><li><a href="#impl-Unpin-for-BinaryFirstLvlOpParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BinaryFirstLvlOpParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</a></h2></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `BinaryFirstLvlOpParser` struct in crate `edlang_parser`."><title>BinaryFirstLvlOpParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">BinaryFirstLvlOpParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-BinaryFirstLvlOpParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BinaryFirstLvlOpParser">Send</a></li><li><a href="#impl-Sync-for-BinaryFirstLvlOpParser">Sync</a></li><li><a href="#impl-Unpin-for-BinaryFirstLvlOpParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BinaryFirstLvlOpParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</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="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">BinaryFirstLvlOpParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#10197-10199">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct BinaryFirstLvlOpParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-BinaryFirstLvlOpParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#10201-10226">source</a><a href="#impl-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#10202-10206">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#10209-10225">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">BinaryFirstLvlOpParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#10138-10140">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct BinaryFirstLvlOpParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-BinaryFirstLvlOpParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#10142-10167">source</a><a href="#impl-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#10143-10147">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#10150-10166">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
||||||
&self,
|
&self,
|
||||||
__tokens0: __TOKENS
|
__tokens0: __TOKENS
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="../../../edlang_ast/enum.BinaryOp.html" title="enum edlang_ast::BinaryOp">BinaryOp</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-RefUnwindSafe-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section><section id="impl-Send-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-Send-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section><section id="impl-Sync-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-Sync-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section><section id="impl-Unpin-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-Unpin-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section><section id="impl-UnwindSafe-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-UnwindSafe-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="../../../edlang_ast/enum.BinaryOp.html" title="enum edlang_ast::BinaryOp">BinaryOp</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-RefUnwindSafe-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section><section id="impl-Send-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-Send-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section><section id="impl-Sync-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-Sync-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section><section id="impl-Unpin-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-Unpin-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section><section id="impl-UnwindSafe-for-BinaryFirstLvlOpParser" class="impl"><a href="#impl-UnwindSafe-for-BinaryFirstLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BinaryFirstLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryFirstLvlOpParser">BinaryFirstLvlOpParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!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="API documentation for the Rust `BinarySecondLvlOpParser` struct in crate `edlang_parser`."><title>BinarySecondLvlOpParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">BinarySecondLvlOpParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-BinarySecondLvlOpParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BinarySecondLvlOpParser">Send</a></li><li><a href="#impl-Sync-for-BinarySecondLvlOpParser">Sync</a></li><li><a href="#impl-Unpin-for-BinarySecondLvlOpParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BinarySecondLvlOpParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</a></h2></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `BinarySecondLvlOpParser` struct in crate `edlang_parser`."><title>BinarySecondLvlOpParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">BinarySecondLvlOpParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-BinarySecondLvlOpParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BinarySecondLvlOpParser">Send</a></li><li><a href="#impl-Sync-for-BinarySecondLvlOpParser">Sync</a></li><li><a href="#impl-Unpin-for-BinarySecondLvlOpParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BinarySecondLvlOpParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</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="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">BinarySecondLvlOpParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#17867-17869">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct BinarySecondLvlOpParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-BinarySecondLvlOpParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#17871-17896">source</a><a href="#impl-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#17872-17876">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#17879-17895">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">BinarySecondLvlOpParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#17761-17763">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct BinarySecondLvlOpParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-BinarySecondLvlOpParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#17765-17790">source</a><a href="#impl-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#17766-17770">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#17773-17789">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
||||||
&self,
|
&self,
|
||||||
__tokens0: __TOKENS
|
__tokens0: __TOKENS
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="../../../edlang_ast/enum.BinaryOp.html" title="enum edlang_ast::BinaryOp">BinaryOp</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-RefUnwindSafe-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section><section id="impl-Send-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-Send-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section><section id="impl-Sync-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-Sync-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section><section id="impl-Unpin-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-Unpin-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section><section id="impl-UnwindSafe-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-UnwindSafe-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="../../../edlang_ast/enum.BinaryOp.html" title="enum edlang_ast::BinaryOp">BinaryOp</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-RefUnwindSafe-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section><section id="impl-Send-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-Send-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section><section id="impl-Sync-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-Sync-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section><section id="impl-Unpin-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-Unpin-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section><section id="impl-UnwindSafe-for-BinarySecondLvlOpParser" class="impl"><a href="#impl-UnwindSafe-for-BinarySecondLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BinarySecondLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinarySecondLvlOpParser">BinarySecondLvlOpParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!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="API documentation for the Rust `BinaryThirdLvlOpParser` struct in crate `edlang_parser`."><title>BinaryThirdLvlOpParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">BinaryThirdLvlOpParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-BinaryThirdLvlOpParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BinaryThirdLvlOpParser">Send</a></li><li><a href="#impl-Sync-for-BinaryThirdLvlOpParser">Sync</a></li><li><a href="#impl-Unpin-for-BinaryThirdLvlOpParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BinaryThirdLvlOpParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</a></h2></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `BinaryThirdLvlOpParser` struct in crate `edlang_parser`."><title>BinaryThirdLvlOpParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">BinaryThirdLvlOpParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-BinaryThirdLvlOpParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BinaryThirdLvlOpParser">Send</a></li><li><a href="#impl-Sync-for-BinaryThirdLvlOpParser">Sync</a></li><li><a href="#impl-Unpin-for-BinaryThirdLvlOpParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BinaryThirdLvlOpParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</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="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">BinaryThirdLvlOpParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#25545-25547">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct BinaryThirdLvlOpParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-BinaryThirdLvlOpParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#25549-25574">source</a><a href="#impl-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#25550-25554">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#25557-25573">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">BinaryThirdLvlOpParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#25392-25394">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct BinaryThirdLvlOpParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-BinaryThirdLvlOpParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#25396-25421">source</a><a href="#impl-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#25397-25401">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#25404-25420">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
||||||
&self,
|
&self,
|
||||||
__tokens0: __TOKENS
|
__tokens0: __TOKENS
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="../../../edlang_ast/enum.BinaryOp.html" title="enum edlang_ast::BinaryOp">BinaryOp</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-RefUnwindSafe-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section><section id="impl-Send-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-Send-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section><section id="impl-Sync-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-Sync-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section><section id="impl-Unpin-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-Unpin-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section><section id="impl-UnwindSafe-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-UnwindSafe-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="../../../edlang_ast/enum.BinaryOp.html" title="enum edlang_ast::BinaryOp">BinaryOp</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-RefUnwindSafe-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section><section id="impl-Send-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-Send-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section><section id="impl-Sync-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-Sync-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section><section id="impl-Unpin-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-Unpin-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section><section id="impl-UnwindSafe-for-BinaryThirdLvlOpParser" class="impl"><a href="#impl-UnwindSafe-for-BinaryThirdLvlOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BinaryThirdLvlOpParser.html" title="struct edlang_parser::grammar::grammar::BinaryThirdLvlOpParser">BinaryThirdLvlOpParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!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="API documentation for the Rust `ModuleParser` struct in crate `edlang_parser`."><title>ModuleParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">ModuleParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-ModuleParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-ModuleParser">Send</a></li><li><a href="#impl-Sync-for-ModuleParser">Sync</a></li><li><a href="#impl-Unpin-for-ModuleParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-ModuleParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</a></h2></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `ModuleParser` struct in crate `edlang_parser`."><title>ModuleParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">ModuleParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-ModuleParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-ModuleParser">Send</a></li><li><a href="#impl-Sync-for-ModuleParser">Sync</a></li><li><a href="#impl-Unpin-for-ModuleParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-ModuleParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</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="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">ModuleParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#164838-164840">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct ModuleParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-ModuleParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#164842-164867">source</a><a href="#impl-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#164843-164847">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#164850-164866">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">ModuleParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#163878-163880">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct ModuleParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-ModuleParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#163882-163907">source</a><a href="#impl-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#163883-163887">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#163890-163906">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
||||||
&self,
|
&self,
|
||||||
__tokens0: __TOKENS
|
__tokens0: __TOKENS
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../../../edlang_ast/struct.Module.html" title="struct edlang_ast::Module">Module</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-ModuleParser" class="impl"><a href="#impl-RefUnwindSafe-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section><section id="impl-Send-for-ModuleParser" class="impl"><a href="#impl-Send-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section><section id="impl-Sync-for-ModuleParser" class="impl"><a href="#impl-Sync-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section><section id="impl-Unpin-for-ModuleParser" class="impl"><a href="#impl-Unpin-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section><section id="impl-UnwindSafe-for-ModuleParser" class="impl"><a href="#impl-UnwindSafe-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../../../edlang_ast/struct.Module.html" title="struct edlang_ast::Module">Module</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-ModuleParser" class="impl"><a href="#impl-RefUnwindSafe-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section><section id="impl-Send-for-ModuleParser" class="impl"><a href="#impl-Send-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section><section id="impl-Sync-for-ModuleParser" class="impl"><a href="#impl-Sync-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section><section id="impl-Unpin-for-ModuleParser" class="impl"><a href="#impl-Unpin-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section><section id="impl-UnwindSafe-for-ModuleParser" class="impl"><a href="#impl-UnwindSafe-for-ModuleParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.ModuleParser.html" title="struct edlang_parser::grammar::grammar::ModuleParser">ModuleParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!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="API documentation for the Rust `ModulesParser` struct in crate `edlang_parser`."><title>ModulesParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">ModulesParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-ModulesParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-ModulesParser">Send</a></li><li><a href="#impl-Sync-for-ModulesParser">Sync</a></li><li><a href="#impl-Unpin-for-ModulesParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-ModulesParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</a></h2></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `ModulesParser` struct in crate `edlang_parser`."><title>ModulesParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">ModulesParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-ModulesParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-ModulesParser">Send</a></li><li><a href="#impl-Sync-for-ModulesParser">Sync</a></li><li><a href="#impl-Unpin-for-ModulesParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-ModulesParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</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="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">ModulesParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#182735-182737">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct ModulesParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-ModulesParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#182739-182764">source</a><a href="#impl-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#182740-182744">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#182747-182763">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">ModulesParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#181673-181675">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct ModulesParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-ModulesParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#181677-181702">source</a><a href="#impl-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#181678-181682">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#181685-181701">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
||||||
&self,
|
&self,
|
||||||
__tokens0: __TOKENS
|
__tokens0: __TOKENS
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../../../edlang_ast/struct.Module.html" title="struct edlang_ast::Module">Module</a>>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-ModulesParser" class="impl"><a href="#impl-RefUnwindSafe-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section><section id="impl-Send-for-ModulesParser" class="impl"><a href="#impl-Send-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section><section id="impl-Sync-for-ModulesParser" class="impl"><a href="#impl-Sync-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section><section id="impl-Unpin-for-ModulesParser" class="impl"><a href="#impl-Unpin-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section><section id="impl-UnwindSafe-for-ModulesParser" class="impl"><a href="#impl-UnwindSafe-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../../../edlang_ast/struct.Module.html" title="struct edlang_ast::Module">Module</a>>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-ModulesParser" class="impl"><a href="#impl-RefUnwindSafe-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section><section id="impl-Send-for-ModulesParser" class="impl"><a href="#impl-Send-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section><section id="impl-Sync-for-ModulesParser" class="impl"><a href="#impl-Sync-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section><section id="impl-Unpin-for-ModulesParser" class="impl"><a href="#impl-Unpin-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section><section id="impl-UnwindSafe-for-ModulesParser" class="impl"><a href="#impl-UnwindSafe-for-ModulesParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.ModulesParser.html" title="struct edlang_parser::grammar::grammar::ModulesParser">ModulesParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!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="API documentation for the Rust `PathSegmentsParser` struct in crate `edlang_parser`."><title>PathSegmentsParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">PathSegmentsParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-PathSegmentsParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-PathSegmentsParser">Send</a></li><li><a href="#impl-Sync-for-PathSegmentsParser">Sync</a></li><li><a href="#impl-Unpin-for-PathSegmentsParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-PathSegmentsParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</a></h2></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `PathSegmentsParser` struct in crate `edlang_parser`."><title>PathSegmentsParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">PathSegmentsParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-PathSegmentsParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-PathSegmentsParser">Send</a></li><li><a href="#impl-Sync-for-PathSegmentsParser">Sync</a></li><li><a href="#impl-Unpin-for-PathSegmentsParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-PathSegmentsParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</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="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">PathSegmentsParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#207224-207226">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct PathSegmentsParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-PathSegmentsParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#207228-207253">source</a><a href="#impl-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#207229-207233">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#207236-207252">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">PathSegmentsParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#206021-206023">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct PathSegmentsParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-PathSegmentsParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#206025-206050">source</a><a href="#impl-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#206026-206030">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#206033-206049">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
||||||
&self,
|
&self,
|
||||||
__tokens0: __TOKENS
|
__tokens0: __TOKENS
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="../../../edlang_ast/enum.PathSegment.html" title="enum edlang_ast::PathSegment">PathSegment</a>>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-PathSegmentsParser" class="impl"><a href="#impl-RefUnwindSafe-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section><section id="impl-Send-for-PathSegmentsParser" class="impl"><a href="#impl-Send-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section><section id="impl-Sync-for-PathSegmentsParser" class="impl"><a href="#impl-Sync-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section><section id="impl-Unpin-for-PathSegmentsParser" class="impl"><a href="#impl-Unpin-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section><section id="impl-UnwindSafe-for-PathSegmentsParser" class="impl"><a href="#impl-UnwindSafe-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="../../../edlang_ast/enum.PathSegment.html" title="enum edlang_ast::PathSegment">PathSegment</a>>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-PathSegmentsParser" class="impl"><a href="#impl-RefUnwindSafe-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section><section id="impl-Send-for-PathSegmentsParser" class="impl"><a href="#impl-Send-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section><section id="impl-Sync-for-PathSegmentsParser" class="impl"><a href="#impl-Sync-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section><section id="impl-Unpin-for-PathSegmentsParser" class="impl"><a href="#impl-Unpin-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section><section id="impl-UnwindSafe-for-PathSegmentsParser" class="impl"><a href="#impl-UnwindSafe-for-PathSegmentsParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.PathSegmentsParser.html" title="struct edlang_parser::grammar::grammar::PathSegmentsParser">PathSegmentsParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!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="API documentation for the Rust `UnaryOpParser` struct in crate `edlang_parser`."><title>UnaryOpParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">UnaryOpParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-UnaryOpParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-UnaryOpParser">Send</a></li><li><a href="#impl-Sync-for-UnaryOpParser">Sync</a></li><li><a href="#impl-Unpin-for-UnaryOpParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-UnaryOpParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</a></h2></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `UnaryOpParser` struct in crate `edlang_parser`."><title>UnaryOpParser in edlang_parser::grammar::grammar - 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="edlang_parser" 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 struct"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">UnaryOpParser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-UnaryOpParser">RefUnwindSafe</a></li><li><a href="#impl-Send-for-UnaryOpParser">Send</a></li><li><a href="#impl-Sync-for-UnaryOpParser">Sync</a></li><li><a href="#impl-Unpin-for-UnaryOpParser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-UnaryOpParser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In edlang_parser::grammar::grammar</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="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">UnaryOpParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#295239-295241">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct UnaryOpParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-UnaryOpParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#295243-295268">source</a><a href="#impl-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#295244-295248">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#295251-295267">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../edlang_parser/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>Struct <a href="../../index.html">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="struct" href="#">UnaryOpParser</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#293519-293521">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct UnaryOpParser { <span class="comment">/* private fields */</span> }</code></pre><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-UnaryOpParser" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#293523-293548">source</a><a href="#impl-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#293524-293528">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h4></section><section id="method.parse" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#293531-293547">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a><__TOKEN: <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a>, __TOKENS: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = __TOKEN>>(
|
||||||
&self,
|
&self,
|
||||||
__tokens0: __TOKENS
|
__tokens0: __TOKENS
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="../../../edlang_ast/enum.UnaryOp.html" title="enum edlang_ast::UnaryOp">UnaryOp</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-UnaryOpParser" class="impl"><a href="#impl-RefUnwindSafe-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section><section id="impl-Send-for-UnaryOpParser" class="impl"><a href="#impl-Send-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section><section id="impl-Sync-for-UnaryOpParser" class="impl"><a href="#impl-Sync-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section><section id="impl-Unpin-for-UnaryOpParser" class="impl"><a href="#impl-Unpin-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section><section id="impl-UnwindSafe-for-UnaryOpParser" class="impl"><a href="#impl-UnwindSafe-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="../../../edlang_ast/enum.UnaryOp.html" title="enum edlang_ast::UnaryOp">UnaryOp</a>, <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-UnaryOpParser" class="impl"><a href="#impl-RefUnwindSafe-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section><section id="impl-Send-for-UnaryOpParser" class="impl"><a href="#impl-Send-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section><section id="impl-Sync-for-UnaryOpParser" class="impl"><a href="#impl-Sync-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section><section id="impl-Unpin-for-UnaryOpParser" class="impl"><a href="#impl-Unpin-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section><section id="impl-UnwindSafe-for-UnaryOpParser" class="impl"><a href="#impl-UnwindSafe-for-UnaryOpParser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.UnaryOpParser.html" title="struct edlang_parser::grammar::grammar::UnaryOpParser">UnaryOpParser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<!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="API documentation for the Rust `__ToTriple` trait in crate `edlang_parser`."><title>__ToTriple in edlang_parser::grammar::grammar - 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="edlang_parser" 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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">__ToTriple</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.to_triple">to_triple</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-__ToTriple-for-(usize,+Token,+usize)">(usize, Token, usize)</a></li><li><a href="#impl-__ToTriple-for-Result%3C(usize,+Token,+usize),+LexicalError%3E">Result<(usize, Token, usize), LexicalError></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 edlang_parser::grammar::grammar</a></h2></div></nav><div class="sidebar-resizer"></div>
|
<!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="API documentation for the Rust `__ToTriple` trait in crate `edlang_parser`."><title>__ToTriple in edlang_parser::grammar::grammar - 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="edlang_parser" 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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../edlang_parser/index.html">edlang_parser</a><span class="version">0.0.1-alpha.10</span></h2></div><h2 class="location"><a href="#">__ToTriple</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.to_triple">to_triple</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-__ToTriple-for-(usize,+Token,+usize)">(usize, Token, usize)</a></li><li><a href="#impl-__ToTriple-for-Result%3C(usize,+Token,+usize),+LexicalError%3E">Result<(usize, Token, usize), LexicalError></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 edlang_parser::grammar::grammar</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="../../../edlang_parser/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">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="trait" href="#">__ToTriple</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#325685-325688">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub trait __ToTriple {
|
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../edlang_parser/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">edlang_parser</a>::<wbr><a href="../index.html">grammar</a>::<wbr><a href="index.html">grammar</a>::<wbr><a class="trait" href="#">__ToTriple</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/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#323769-323772">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub trait __ToTriple {
|
||||||
// Required method
|
// Required method
|
||||||
fn <a href="#tymethod.to_triple" class="fn">to_triple</a>(
|
fn <a href="#tymethod.to_triple" class="fn">to_triple</a>(
|
||||||
value: Self
|
value: Self
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>>;
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>>;
|
||||||
}</code></pre><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><section id="tymethod.to_triple" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#325687">source</a><h4 class="code-header">fn <a href="#tymethod.to_triple" class="fn">to_triple</a>(
|
}</code></pre><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><section id="tymethod.to_triple" class="method"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#323771">source</a><h4 class="code-header">fn <a href="#tymethod.to_triple" class="fn">to_triple</a>(
|
||||||
value: Self
|
value: Self
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></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="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-__ToTriple-for-(usize,+Token,+usize)" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#325690-325695">source</a><a href="#impl-__ToTriple-for-(usize,+Token,+usize)" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a> for (<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>)</h3></section></summary><div class="impl-items"><section id="method.to_triple" class="method trait-impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#325692-325694">source</a><a href="#method.to_triple" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.to_triple" class="fn">to_triple</a>(
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></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="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-__ToTriple-for-(usize,+Token,+usize)" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#323774-323779">source</a><a href="#impl-__ToTriple-for-(usize,+Token,+usize)" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a> for (<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>)</h3></section></summary><div class="impl-items"><section id="method.to_triple" class="method trait-impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#323776-323778">source</a><a href="#method.to_triple" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.to_triple" class="fn">to_triple</a>(
|
||||||
value: Self
|
value: Self
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-__ToTriple-for-Result%3C(usize,+Token,+usize),+LexicalError%3E" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#325696-325704">source</a><a href="#impl-__ToTriple-for-Result%3C(usize,+Token,+usize),+LexicalError%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a> for <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>></h3></section></summary><div class="impl-items"><section id="method.to_triple-1" class="method trait-impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#325698-325703">source</a><a href="#method.to_triple-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.to_triple" class="fn">to_triple</a>(
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-__ToTriple-for-Result%3C(usize,+Token,+usize),+LexicalError%3E" class="impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#323780-323788">source</a><a href="#impl-__ToTriple-for-Result%3C(usize,+Token,+usize),+LexicalError%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.__ToTriple.html" title="trait edlang_parser::grammar::grammar::__ToTriple">__ToTriple</a> for <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>></h3></section></summary><div class="impl-items"><section id="method.to_triple-1" class="method trait-impl"><a class="src rightside" href="../../../src/edlang_parser/home/runner/work/edlang/edlang/target/debug/build/edlang_parser-2424ac56b73fbc2b/out/grammar.rs.html#323782-323787">source</a><a href="#method.to_triple-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.to_triple" class="fn">to_triple</a>(
|
||||||
value: Self
|
value: Self
|
||||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../../trait.impl/edlang_parser/grammar/grammar/trait.__ToTriple.js" data-ignore-extern-crates="std,core" async></script></section></div></main></body></html>
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>), <a class="enum" href="../../../lalrpop_util/enum.ParseError.html" title="enum lalrpop_util::ParseError">ParseError</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../../tokens/enum.Token.html" title="enum edlang_parser::tokens::Token">Token</a>, <a class="enum" href="../../lexer/enum.LexicalError.html" title="enum edlang_parser::lexer::LexicalError">LexicalError</a>>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../../trait.impl/edlang_parser/grammar/grammar/trait.__ToTriple.js" data-ignore-extern-crates="std,core" async></script></section></div></main></body></html>
|
2
educe/all.html
Normal file
2
educe/all.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<!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="List of all items in this crate"><title>List of all items in this crate</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="educe" 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="../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 sys"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../educe/index.html">educe</a><span class="version">0.5.11</span></h2></div><div class="sidebar-elems"><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="../educe/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"><h1>List of all items</h1><h3 id="derives">Derive Macros</h3><ul class="all-items"><li><a href="derive.Educe.html">Educe</a></li></ul></section></div></main></body></html>
|
7
educe/derive.Educe.html
Normal file
7
educe/derive.Educe.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<!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="API documentation for the Rust `Educe` derive in crate `educe`."><title>Educe in educe - 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="educe" 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 derive"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../educe/index.html">educe</a><span class="version">0.5.11</span></h2></div><div class="sidebar-elems"></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="../educe/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>Derive Macro <a href="index.html">educe</a>::<wbr><a class="derive" href="#">Educe</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/educe/lib.rs.html#2003-2019">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>#[derive(Educe)]
|
||||||
|
{
|
||||||
|
<span class="comment">// Attributes available to this derive:</span>
|
||||||
|
#[educe]
|
||||||
|
}
|
||||||
|
</code></pre></section></div></main></body></html>
|
1326
educe/index.html
Normal file
1326
educe/index.html
Normal file
File diff suppressed because it is too large
Load diff
1
educe/sidebar-items.js
Normal file
1
educe/sidebar-items.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
window.SIDEBAR_ITEMS = {"derive":["Educe"]};
|
2
enum_ordinalize/all.html
Normal file
2
enum_ordinalize/all.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<!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="List of all items in this crate"><title>List of all items in this crate</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="enum_ordinalize" 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="../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 sys"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../enum_ordinalize/index.html">enum_ordinalize</a><span class="version">4.3.0</span></h2></div><div class="sidebar-elems"><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="../enum_ordinalize/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"><h1>List of all items</h1><h3 id="derives">Derive Macros</h3><ul class="all-items"><li><a href="derive.Ordinalize.html">Ordinalize</a></li></ul></section></div></main></body></html>
|
7
enum_ordinalize/derive.Ordinalize.html
Normal file
7
enum_ordinalize/derive.Ordinalize.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<!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="API documentation for the Rust `Ordinalize` derive in crate `enum_ordinalize`."><title>Ordinalize in enum_ordinalize - 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="enum_ordinalize" 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 derive"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../enum_ordinalize/index.html">enum_ordinalize</a><span class="version">4.3.0</span></h2></div><div class="sidebar-elems"></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="../enum_ordinalize/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>Derive Macro <a href="index.html">enum_ordinalize</a>::<wbr><a class="derive" href="#">Ordinalize</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/enum_ordinalize_derive/lib.rs.html#33">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>#[derive(Ordinalize)]
|
||||||
|
{
|
||||||
|
<span class="comment">// Attributes available to this derive:</span>
|
||||||
|
#[ordinalize]
|
||||||
|
}
|
||||||
|
</code></pre></section></div></main></body></html>
|
156
enum_ordinalize/index.html
Normal file
156
enum_ordinalize/index.html
Normal file
|
@ -0,0 +1,156 @@
|
||||||
|
<!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="Enum Ordinalize"><title>enum_ordinalize - 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="enum_ordinalize" 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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../enum_ordinalize/index.html">enum_ordinalize</a><span class="version">4.3.0</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="../enum_ordinalize/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="#">enum_ordinalize</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/enum_ordinalize/lib.rs.html#1-203">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="enum-ordinalize"><a href="#enum-ordinalize">Enum Ordinalize</a></h2>
|
||||||
|
<p>This library enables enums to not only obtain the ordinal values of their variants but also allows for the construction of enums from an ordinal value.</p>
|
||||||
|
<h3 id="usage"><a href="#usage">Usage</a></h3>
|
||||||
|
<p>Use <code>#[derive(Ordinalize)]</code> to have an enum (which must only has unit variants) implement the <code>Ordinalize</code> trait.</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>enum_ordinalize::Ordinalize;
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug, PartialEq, Eq, Ordinalize)]
|
||||||
|
</span><span class="kw">enum </span>MyEnum {
|
||||||
|
Zero,
|
||||||
|
One,
|
||||||
|
Two,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">3</span>, MyEnum::VARIANT_COUNT);
|
||||||
|
<span class="macro">assert_eq!</span>([MyEnum::Zero, MyEnum::One, MyEnum::Two], MyEnum::VARIANTS);
|
||||||
|
<span class="macro">assert_eq!</span>([<span class="number">0i8</span>, <span class="number">1i8</span>, <span class="number">2i8</span>], MyEnum::VALUES);
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">0i8</span>, MyEnum::Zero.ordinal());
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">1i8</span>, MyEnum::One.ordinal());
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">2i8</span>, MyEnum::Two.ordinal());
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::Zero), MyEnum::from_ordinal(<span class="number">0i8</span>));
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::One), MyEnum::from_ordinal(<span class="number">1i8</span>));
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::Two), MyEnum::from_ordinal(<span class="number">2i8</span>));
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::Zero, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">0i8</span>) });
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::One, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">1i8</span>) });
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::Two, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">2i8</span>) });</code></pre></div>
|
||||||
|
<h5 id="the-ordinal-size-of-an-enum"><a href="#the-ordinal-size-of-an-enum">The (Ordinal) Size of an Enum</a></h5>
|
||||||
|
<p>The ordinal value is an integer whose size is determined by the enum itself. The size of the enum increases with the magnitude of the variants’ values, whether larger (or smaller if negative).</p>
|
||||||
|
<p>For example,</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>enum_ordinalize::Ordinalize;
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug, PartialEq, Eq, Ordinalize)]
|
||||||
|
</span><span class="kw">enum </span>MyEnum {
|
||||||
|
Zero,
|
||||||
|
One,
|
||||||
|
Two,
|
||||||
|
Thousand = <span class="number">1000</span>,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">4</span>, MyEnum::VARIANT_COUNT);
|
||||||
|
<span class="macro">assert_eq!</span>([MyEnum::Zero, MyEnum::One, MyEnum::Two, MyEnum::Thousand], MyEnum::VARIANTS);
|
||||||
|
<span class="macro">assert_eq!</span>([<span class="number">0i16</span>, <span class="number">1i16</span>, <span class="number">2i16</span>, <span class="number">1000i16</span>], MyEnum::VALUES);
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">0i16</span>, MyEnum::Zero.ordinal());
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">1i16</span>, MyEnum::One.ordinal());
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">2i16</span>, MyEnum::Two.ordinal());
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::Zero), MyEnum::from_ordinal(<span class="number">0i16</span>));
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::One), MyEnum::from_ordinal(<span class="number">1i16</span>));
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::Two), MyEnum::from_ordinal(<span class="number">2i16</span>));
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::Zero, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">0i16</span>) });
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::One, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">1i16</span>) });
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::Two, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">2i16</span>) });</code></pre></div>
|
||||||
|
<p>In order to accommodate the value <code>1000</code>, the size of <code>MyEnum</code> increases. Consequently, the ordinal is represented in <code>i16</code> instead of <code>i8</code>.</p>
|
||||||
|
<p>You can utilize the <code>#[repr(type)]</code> attribute to explicitly control the size. For instance,</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>enum_ordinalize::Ordinalize;
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug, PartialEq, Eq, Ordinalize)]
|
||||||
|
#[repr(usize)]
|
||||||
|
</span><span class="kw">enum </span>MyEnum {
|
||||||
|
Zero,
|
||||||
|
One,
|
||||||
|
Two,
|
||||||
|
Thousand = <span class="number">1000</span>,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">4</span>, MyEnum::VARIANT_COUNT);
|
||||||
|
<span class="macro">assert_eq!</span>([MyEnum::Zero, MyEnum::One, MyEnum::Two, MyEnum::Thousand], MyEnum::VARIANTS);
|
||||||
|
<span class="macro">assert_eq!</span>([<span class="number">0usize</span>, <span class="number">1usize</span>, <span class="number">2usize</span>, <span class="number">1000usize</span>], MyEnum::VALUES);
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">0usize</span>, MyEnum::Zero.ordinal());
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">1usize</span>, MyEnum::One.ordinal());
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">2usize</span>, MyEnum::Two.ordinal());
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::Zero), MyEnum::from_ordinal(<span class="number">0usize</span>));
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::One), MyEnum::from_ordinal(<span class="number">1usize</span>));
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::Two), MyEnum::from_ordinal(<span class="number">2usize</span>));
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::Zero, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">0usize</span>) });
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::One, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">1usize</span>) });
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::Two, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">2usize</span>) });</code></pre></div>
|
||||||
|
<h5 id="useful-increment"><a href="#useful-increment">Useful Increment</a></h5>
|
||||||
|
<p>The integers represented by variants can be extended in successive increments and set explicitly from any value.</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>enum_ordinalize::Ordinalize;
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug, PartialEq, Eq, Ordinalize)]
|
||||||
|
</span><span class="kw">enum </span>MyEnum {
|
||||||
|
Two = <span class="number">2</span>,
|
||||||
|
Three,
|
||||||
|
Four,
|
||||||
|
Eight = <span class="number">8</span>,
|
||||||
|
Nine,
|
||||||
|
NegativeTen = -<span class="number">10</span>,
|
||||||
|
NegativeNine,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">7</span>, MyEnum::VARIANT_COUNT);
|
||||||
|
<span class="macro">assert_eq!</span>([MyEnum::Two, MyEnum::Three, MyEnum::Four, MyEnum::Eight, MyEnum::Nine, MyEnum::NegativeTen, MyEnum::NegativeNine], MyEnum::VARIANTS);
|
||||||
|
<span class="macro">assert_eq!</span>([<span class="number">2i8</span>, <span class="number">3i8</span>, <span class="number">4i8</span>, <span class="number">8i8</span>, <span class="number">9i8</span>, -<span class="number">10i8</span>, -<span class="number">9i8</span>], MyEnum::VALUES);
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">4i8</span>, MyEnum::Four.ordinal());
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">9i8</span>, MyEnum::Nine.ordinal());
|
||||||
|
<span class="macro">assert_eq!</span>(-<span class="number">9i8</span>, MyEnum::NegativeNine.ordinal());
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::Four), MyEnum::from_ordinal(<span class="number">4i8</span>));
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::Nine), MyEnum::from_ordinal(<span class="number">9i8</span>));
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::NegativeNine), MyEnum::from_ordinal(-<span class="number">9i8</span>));
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::Four, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">4i8</span>) });
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::Nine, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">9i8</span>) });
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::NegativeNine, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(-<span class="number">9i8</span>) });</code></pre></div>
|
||||||
|
<h5 id="implement-functionality-for-an-enum-on-itself"><a href="#implement-functionality-for-an-enum-on-itself">Implement Functionality for an enum on Itself</a></h5>
|
||||||
|
<p>For some reason, if you don’t want to implement the <code>Ordinalize</code> trait for your enum, you can choose to disable the trait implementation and enable the constants/functions one by one. Functions are <code>const fn</code>. Names and visibility can also be defined by you.</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>enum_ordinalize::Ordinalize;
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug, PartialEq, Eq, Ordinalize)]
|
||||||
|
#[ordinalize(impl_trait = <span class="bool-val">false</span>)]
|
||||||
|
#[ordinalize(variant_count(<span class="kw">pub const </span>VARIANT_COUNT, doc = <span class="string">"The count of variants."</span>))]
|
||||||
|
#[ordinalize(variants(<span class="kw">pub const </span>VARIANTS, doc = <span class="string">"List of this enum's variants."</span>))]
|
||||||
|
#[ordinalize(values(<span class="kw">pub const </span>VALUES, doc = <span class="string">"List of values for all variants of this enum."</span>))]
|
||||||
|
#[ordinalize(ordinal(<span class="kw">pub const fn </span>ordinal, doc = <span class="string">"Retrieve the integer number of this variant."</span>))]
|
||||||
|
#[ordinalize(from_ordinal(<span class="kw">pub const fn </span>from_ordinal, doc = <span class="string">"Obtain a variant based on an integer number."</span>))]
|
||||||
|
#[ordinalize(from_ordinal_unsafe(
|
||||||
|
<span class="kw">pub const fn </span>from_ordinal_unsafe,
|
||||||
|
doc = <span class="string">"Obtain a variant based on an integer number."</span>,
|
||||||
|
doc = <span class="string">"# Safety"</span>,
|
||||||
|
doc = <span class="string">"You have to ensure that the input integer number can correspond to a variant on your own."</span>,
|
||||||
|
))]
|
||||||
|
</span><span class="kw">enum </span>MyEnum {
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">2</span>, MyEnum::VARIANT_COUNT);
|
||||||
|
<span class="macro">assert_eq!</span>([MyEnum::A, MyEnum::B], MyEnum::VARIANTS);
|
||||||
|
<span class="macro">assert_eq!</span>([<span class="number">0i8</span>, <span class="number">1i8</span>], MyEnum::VALUES);
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">0i8</span>, MyEnum::A.ordinal());
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="number">1i8</span>, MyEnum::B.ordinal());
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::A), MyEnum::from_ordinal(<span class="number">0i8</span>));
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(MyEnum::B), MyEnum::from_ordinal(<span class="number">1i8</span>));
|
||||||
|
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::A, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">0i8</span>) });
|
||||||
|
<span class="macro">assert_eq!</span>(MyEnum::B, <span class="kw">unsafe </span>{ MyEnum::from_ordinal_unsafe(<span class="number">1i8</span>) });</code></pre></div>
|
||||||
|
</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.Ordinalize.html" title="derive enum_ordinalize::Ordinalize">Ordinalize</a></div></li></ul></section></div></main></body></html>
|
1
enum_ordinalize/sidebar-items.js
Normal file
1
enum_ordinalize/sidebar-items.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
window.SIDEBAR_ITEMS = {"derive":["Ordinalize"]};
|
2
enum_ordinalize_derive/all.html
Normal file
2
enum_ordinalize_derive/all.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<!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="List of all items in this crate"><title>List of all items in this crate</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="enum_ordinalize_derive" 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="../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 sys"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../enum_ordinalize_derive/index.html">enum_ordinalize_derive</a><span class="version">4.3.1</span></h2></div><div class="sidebar-elems"><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="../enum_ordinalize_derive/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"><h1>List of all items</h1><h3 id="derives">Derive Macros</h3><ul class="all-items"><li><a href="derive.Ordinalize.html">Ordinalize</a></li></ul></section></div></main></body></html>
|
7
enum_ordinalize_derive/derive.Ordinalize.html
Normal file
7
enum_ordinalize_derive/derive.Ordinalize.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<!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="API documentation for the Rust `Ordinalize` derive in crate `enum_ordinalize_derive`."><title>Ordinalize in enum_ordinalize_derive - 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="enum_ordinalize_derive" 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 derive"><!--[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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../enum_ordinalize_derive/index.html">enum_ordinalize_derive</a><span class="version">4.3.1</span></h2></div><div class="sidebar-elems"></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="../enum_ordinalize_derive/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>Derive Macro <a href="index.html">enum_ordinalize_derive</a>::<wbr><a class="derive" href="#">Ordinalize</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/enum_ordinalize_derive/lib.rs.html#33-808">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>#[derive(Ordinalize)]
|
||||||
|
{
|
||||||
|
<span class="comment">// Attributes available to this derive:</span>
|
||||||
|
#[ordinalize]
|
||||||
|
}
|
||||||
|
</code></pre></section></div></main></body></html>
|
5
enum_ordinalize_derive/index.html
Normal file
5
enum_ordinalize_derive/index.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!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="Enum Ordinalize Derive"><title>enum_ordinalize_derive - 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="enum_ordinalize_derive" 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">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../enum_ordinalize_derive/index.html">enum_ordinalize_derive</a><span class="version">4.3.1</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="../enum_ordinalize_derive/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="#">enum_ordinalize_derive</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/enum_ordinalize_derive/lib.rs.html#1-808">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="enum-ordinalize-derive"><a href="#enum-ordinalize-derive">Enum Ordinalize Derive</a></h2>
|
||||||
|
<p>This library enables enums to not only obtain the ordinal values of their variants but also allows for the construction of enums from an ordinal value. See the <a href="https://crates.io/crates/enum-ordinalize"><code>enum-ordinalize</code></a> 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.Ordinalize.html" title="derive enum_ordinalize_derive::Ordinalize">Ordinalize</a></div></li></ul></section></div></main></body></html>
|
1
enum_ordinalize_derive/sidebar-items.js
Normal file
1
enum_ordinalize_derive/sidebar-items.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
window.SIDEBAR_ITEMS = {"derive":["Ordinalize"]};
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -29,7 +29,10 @@ var srcIndex = new Map(JSON.parse('[\
|
||||||
["edlang_parser",["",[],["error.rs","lexer.rs","lib.rs","tokens.rs"]]],\
|
["edlang_parser",["",[],["error.rs","lexer.rs","lib.rs","tokens.rs"]]],\
|
||||||
["edlang_session",["",[],["lib.rs"]]],\
|
["edlang_session",["",[],["lib.rs"]]],\
|
||||||
["edlang_span",["",[],["lib.rs"]]],\
|
["edlang_span",["",[],["lib.rs"]]],\
|
||||||
|
["educe",["",[["common",[["tools",[],["discriminant_type.rs","hash_type.rs","mod.rs"]]],["bound.rs","expr.rs","ident_bool.rs","ident_index.rs","int.rs","mod.rs","path.rs","type.rs","unsafe_punctuated_meta.rs","where_predicates_bool.rs"]],["trait_handlers",[["clone",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["clone_enum.rs","clone_struct.rs","clone_union.rs","mod.rs"]],["copy",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["mod.rs"]],["debug",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["common.rs","debug_enum.rs","debug_struct.rs","debug_union.rs","mod.rs","panic.rs"]],["default",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["default_enum.rs","default_struct.rs","default_union.rs","mod.rs","panic.rs"]],["deref",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["deref_enum.rs","deref_struct.rs","mod.rs","panic.rs"]],["deref_mut",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["deref_mut_enum.rs","deref_mut_struct.rs","mod.rs","panic.rs"]],["eq",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["mod.rs"]],["hash",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["hash_enum.rs","hash_struct.rs","hash_union.rs","mod.rs","panic.rs"]],["into",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["common.rs","into_enum.rs","into_struct.rs","mod.rs","panic.rs"]],["ord",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["mod.rs","ord_enum.rs","ord_struct.rs","panic.rs"]],["partial_eq",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["mod.rs","panic.rs","partial_eq_enum.rs","partial_eq_struct.rs","partial_eq_union.rs"]],["partial_ord",[["models",[],["field_attribute.rs","mod.rs","type_attribute.rs"]]],["mod.rs","panic.rs","partial_ord_enum.rs","partial_ord_struct.rs"]]],["mod.rs"]]],["lib.rs","panic.rs","supported_traits.rs"]]],\
|
||||||
["either",["",[],["iterator.rs","lib.rs"]]],\
|
["either",["",[],["iterator.rs","lib.rs"]]],\
|
||||||
|
["enum_ordinalize",["",[],["lib.rs"]]],\
|
||||||
|
["enum_ordinalize_derive",["",[],["int128.rs","int_wrapper.rs","lib.rs","panic.rs","variant_type.rs"]]],\
|
||||||
["eyre",["",[],["backtrace.rs","chain.rs","context.rs","error.rs","fmt.rs","kind.rs","lib.rs","macros.rs","option.rs","ptr.rs","wrapper.rs"]]],\
|
["eyre",["",[],["backtrace.rs","chain.rs","context.rs","error.rs","fmt.rs","kind.rs","lib.rs","macros.rs","option.rs","ptr.rs","wrapper.rs"]]],\
|
||||||
["fnv",["",[],["lib.rs"]]],\
|
["fnv",["",[],["lib.rs"]]],\
|
||||||
["gimli",["",[["read",[],["abbrev.rs","addr.rs","aranges.rs","cfi.rs","dwarf.rs","endian_slice.rs","index.rs","line.rs","lists.rs","loclists.rs","lookup.rs","mod.rs","op.rs","pubnames.rs","pubtypes.rs","reader.rs","rnglists.rs","str.rs","unit.rs","util.rs","value.rs"]]],["arch.rs","common.rs","constants.rs","endianity.rs","leb128.rs","lib.rs"]]],\
|
["gimli",["",[["read",[],["abbrev.rs","addr.rs","aranges.rs","cfi.rs","dwarf.rs","endian_slice.rs","index.rs","line.rs","lists.rs","loclists.rs","lookup.rs","mod.rs","op.rs","pubnames.rs","pubtypes.rs","reader.rs","rnglists.rs","str.rs","unit.rs","util.rs","value.rs"]]],["arch.rs","common.rs","constants.rs","endianity.rs","leb128.rs","lib.rs"]]],\
|
||||||
|
|
|
@ -397,7 +397,7 @@
|
||||||
<span class="kw">pub </span>is_public: bool,
|
<span class="kw">pub </span>is_public: bool,
|
||||||
<span class="kw">pub </span>params: Vec<FnParam>,
|
<span class="kw">pub </span>params: Vec<FnParam>,
|
||||||
<span class="kw">pub </span>return_type: <span class="prelude-ty">Option</span><Type>,
|
<span class="kw">pub </span>return_type: <span class="prelude-ty">Option</span><Type>,
|
||||||
<span class="kw">pub </span>body: Block,
|
<span class="kw">pub </span>body: <span class="prelude-ty">Option</span><Block>,
|
||||||
<span class="kw">pub </span>span: Span,
|
<span class="kw">pub </span>span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1409,6 +1409,9 @@
|
||||||
<a href="#1408" id="1408">1408</a>
|
<a href="#1408" id="1408">1408</a>
|
||||||
<a href="#1409" id="1409">1409</a>
|
<a href="#1409" id="1409">1409</a>
|
||||||
<a href="#1410" id="1410">1410</a>
|
<a href="#1410" id="1410">1410</a>
|
||||||
|
<a href="#1411" id="1411">1411</a>
|
||||||
|
<a href="#1412" id="1412">1412</a>
|
||||||
|
<a href="#1413" id="1413">1413</a>
|
||||||
</pre></div><pre class="rust"><code><span class="kw">use </span>std::{collections::HashMap, error::Error, path::PathBuf};
|
</pre></div><pre class="rust"><code><span class="kw">use </span>std::{collections::HashMap, error::Error, path::PathBuf};
|
||||||
|
|
||||||
<span class="kw">use </span>edlang_ir <span class="kw">as </span>ir;
|
<span class="kw">use </span>edlang_ir <span class="kw">as </span>ir;
|
||||||
|
@ -1634,9 +1637,7 @@
|
||||||
<span class="kw">let </span>fn_value = ctx.module.add_function(
|
<span class="kw">let </span>fn_value = ctx.module.add_function(
|
||||||
<span class="kw-2">&</span>body.get_mangled_name(),
|
<span class="kw-2">&</span>body.get_mangled_name(),
|
||||||
fn_type,
|
fn_type,
|
||||||
<span class="prelude-val">Some</span>(<span class="kw">if </span>body.is_extern {
|
<span class="prelude-val">Some</span>(<span class="kw">if </span>body.is_pub || body.is_extern {
|
||||||
inkwell::module::Linkage::AvailableExternally
|
|
||||||
} <span class="kw">else if </span>body.is_pub {
|
|
||||||
inkwell::module::Linkage::External
|
inkwell::module::Linkage::External
|
||||||
} <span class="kw">else </span>{
|
} <span class="kw">else </span>{
|
||||||
inkwell::module::Linkage::Private
|
inkwell::module::Linkage::Private
|
||||||
|
@ -1672,7 +1673,7 @@
|
||||||
line <span class="kw">as </span>u32 + <span class="number">1</span>,
|
line <span class="kw">as </span>u32 + <span class="number">1</span>,
|
||||||
di_type,
|
di_type,
|
||||||
body.is_pub,
|
body.is_pub,
|
||||||
<span class="bool-val">true</span>,
|
!body.is_extern,
|
||||||
line <span class="kw">as </span>u32 + <span class="number">1</span>,
|
line <span class="kw">as </span>u32 + <span class="number">1</span>,
|
||||||
<span class="number">0</span>,
|
<span class="number">0</span>,
|
||||||
<span class="bool-val">false</span>,
|
<span class="bool-val">false</span>,
|
||||||
|
@ -1682,6 +1683,11 @@
|
||||||
|
|
||||||
<span class="kw">fn </span>compile_fn(ctx: <span class="kw-2">&</span>ModuleCompileCtx, fn_id: DefId) -> <span class="prelude-ty">Result</span><(), BuilderError> {
|
<span class="kw">fn </span>compile_fn(ctx: <span class="kw-2">&</span>ModuleCompileCtx, fn_id: DefId) -> <span class="prelude-ty">Result</span><(), BuilderError> {
|
||||||
<span class="kw">let </span>body = ctx.ctx.program.functions.get(<span class="kw-2">&</span>fn_id).unwrap();
|
<span class="kw">let </span>body = ctx.ctx.program.functions.get(<span class="kw-2">&</span>fn_id).unwrap();
|
||||||
|
|
||||||
|
<span class="kw">if </span>body.is_extern {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(());
|
||||||
|
}
|
||||||
|
|
||||||
<span class="macro">trace!</span>(<span class="string">"compiling fn body: {}"</span>, body.name);
|
<span class="macro">trace!</span>(<span class="string">"compiling fn body: {}"</span>, body.name);
|
||||||
|
|
||||||
<span class="kw">let </span>fn_value = ctx.module.get_function(<span class="kw-2">&</span>body.get_mangled_name()).unwrap();
|
<span class="kw">let </span>fn_value = ctx.module.get_function(<span class="kw-2">&</span>body.get_mangled_name()).unwrap();
|
||||||
|
|
|
@ -536,6 +536,13 @@
|
||||||
<a href="#535" id="535">535</a>
|
<a href="#535" id="535">535</a>
|
||||||
<a href="#536" id="536">536</a>
|
<a href="#536" id="536">536</a>
|
||||||
<a href="#537" id="537">537</a>
|
<a href="#537" id="537">537</a>
|
||||||
|
<a href="#538" id="538">538</a>
|
||||||
|
<a href="#539" id="539">539</a>
|
||||||
|
<a href="#540" id="540">540</a>
|
||||||
|
<a href="#541" id="541">541</a>
|
||||||
|
<a href="#542" id="542">542</a>
|
||||||
|
<a href="#543" id="543">543</a>
|
||||||
|
<a href="#544" id="544">544</a>
|
||||||
</pre></div><pre class="rust"><code><span class="comment">// Based on a cfg
|
</pre></div><pre class="rust"><code><span class="comment">// Based on a cfg
|
||||||
|
|
||||||
</span><span class="kw">use </span>std::{
|
</span><span class="kw">use </span>std::{
|
||||||
|
@ -544,6 +551,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
<span class="kw">use </span>edlang_span::Span;
|
<span class="kw">use </span>edlang_span::Span;
|
||||||
|
<span class="kw">use </span>educe::Educe;
|
||||||
<span class="kw">use </span>smallvec::SmallVec;
|
<span class="kw">use </span>smallvec::SmallVec;
|
||||||
|
|
||||||
<span class="kw">pub mod </span>scalar_int;
|
<span class="kw">pub mod </span>scalar_int;
|
||||||
|
@ -629,6 +637,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class="kw">pub fn </span>get_mangled_name(<span class="kw-2">&</span><span class="self">self</span>) -> String {
|
<span class="kw">pub fn </span>get_mangled_name(<span class="kw-2">&</span><span class="self">self</span>) -> String {
|
||||||
|
<span class="kw">if </span><span class="self">self</span>.is_extern {
|
||||||
|
<span class="kw">return </span><span class="self">self</span>.name.clone();
|
||||||
|
}
|
||||||
|
|
||||||
<span class="kw">if </span><span class="self">self</span>.name == <span class="string">"main" </span>{
|
<span class="kw">if </span><span class="self">self</span>.name == <span class="string">"main" </span>{
|
||||||
<span class="string">"main"</span>.to_string()
|
<span class="string">"main"</span>.to_string()
|
||||||
} <span class="kw">else </span>{
|
} <span class="kw">else </span>{
|
||||||
|
@ -759,9 +771,11 @@
|
||||||
<span class="kw">pub </span>targets: Vec<usize>,
|
<span class="kw">pub </span>targets: Vec<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class="attr">#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
<span class="attr">#[derive(Debug, Clone, Educe, Eq, PartialOrd, Ord)]
|
||||||
|
#[educe(PartialEq)]
|
||||||
</span><span class="kw">pub struct </span>TypeInfo {
|
</span><span class="kw">pub struct </span>TypeInfo {
|
||||||
<span class="kw">pub </span>span: <span class="prelude-ty">Option</span><Span>,
|
<span class="attr">#[educe(PartialEq(ignore))]
|
||||||
|
</span><span class="kw">pub </span>span: <span class="prelude-ty">Option</span><Span>,
|
||||||
<span class="kw">pub </span>kind: TypeKind,
|
<span class="kw">pub </span>kind: TypeKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1232,6 +1232,11 @@
|
||||||
<a href="#1231" id="1231">1231</a>
|
<a href="#1231" id="1231">1231</a>
|
||||||
<a href="#1232" id="1232">1232</a>
|
<a href="#1232" id="1232">1232</a>
|
||||||
<a href="#1233" id="1233">1233</a>
|
<a href="#1233" id="1233">1233</a>
|
||||||
|
<a href="#1234" id="1234">1234</a>
|
||||||
|
<a href="#1235" id="1235">1235</a>
|
||||||
|
<a href="#1236" id="1236">1236</a>
|
||||||
|
<a href="#1237" id="1237">1237</a>
|
||||||
|
<a href="#1238" id="1238">1238</a>
|
||||||
</pre></div><pre class="rust"><code><span class="kw">use </span>std::collections::HashMap;
|
</pre></div><pre class="rust"><code><span class="kw">use </span>std::collections::HashMap;
|
||||||
|
|
||||||
<span class="kw">use </span>ast::{BinaryOp, ModuleStatement, Span, WhileStmt};
|
<span class="kw">use </span>ast::{BinaryOp, ModuleStatement, Span, WhileStmt};
|
||||||
|
@ -1404,60 +1409,61 @@
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
<span class="comment">// store args ret
|
<span class="kw">if </span>func.body.is_some() && !func.is_extern {
|
||||||
|
<span class="comment">// store args ret
|
||||||
|
|
||||||
</span>builder.ret_local = builder.body.locals.len();
|
</span>builder.ret_local = builder.body.locals.len();
|
||||||
builder.body.locals.push(Local::new(
|
|
||||||
<span class="prelude-val">None</span>,
|
|
||||||
LocalKind::ReturnPointer,
|
|
||||||
ret_ty.clone(),
|
|
||||||
<span class="prelude-val">None</span>,
|
|
||||||
<span class="bool-val">false</span>,
|
|
||||||
));
|
|
||||||
|
|
||||||
<span class="kw">for </span>(arg, ty) <span class="kw">in </span>func.params.iter().zip(args_ty) {
|
|
||||||
builder
|
|
||||||
.name_to_local
|
|
||||||
.insert(arg.name.name.clone(), builder.body.locals.len());
|
|
||||||
builder.body.locals.push(Local::new(
|
builder.body.locals.push(Local::new(
|
||||||
<span class="prelude-val">Some</span>(arg.name.span),
|
<span class="prelude-val">None</span>,
|
||||||
LocalKind::Arg,
|
LocalKind::ReturnPointer,
|
||||||
ty,
|
ret_ty.clone(),
|
||||||
<span class="prelude-val">Some</span>(arg.name.name.clone()),
|
<span class="prelude-val">None</span>,
|
||||||
<span class="bool-val">false</span>,
|
<span class="bool-val">false</span>,
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
|
||||||
<span class="comment">// Get all user defined locals
|
<span class="kw">for </span>(arg, ty) <span class="kw">in </span>func.params.iter().zip(args_ty) {
|
||||||
</span><span class="kw">for </span>stmt <span class="kw">in </span><span class="kw-2">&</span>func.body.body {
|
|
||||||
<span class="kw">if let </span>ast::Statement::Let(info) = stmt {
|
|
||||||
<span class="kw">let </span>ty = lower_type(<span class="kw-2">&</span>builder.ctx, <span class="kw-2">&</span>info.r#type, builder.local_module)<span class="question-mark">?</span>;
|
|
||||||
builder
|
builder
|
||||||
.name_to_local
|
.name_to_local
|
||||||
.insert(info.name.name.clone(), builder.body.locals.len());
|
.insert(arg.name.name.clone(), builder.body.locals.len());
|
||||||
builder.body.locals.push(Local::new(
|
builder.body.locals.push(Local::new(
|
||||||
<span class="prelude-val">Some</span>(info.name.span),
|
<span class="prelude-val">Some</span>(arg.name.span),
|
||||||
LocalKind::Temp,
|
LocalKind::Arg,
|
||||||
ty,
|
ty,
|
||||||
<span class="prelude-val">Some</span>(info.name.name.clone()),
|
<span class="prelude-val">Some</span>(arg.name.name.clone()),
|
||||||
info.is_mut,
|
<span class="bool-val">false</span>,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
<span class="kw">for </span>stmt <span class="kw">in </span><span class="kw-2">&</span>func.body.body {
|
<span class="comment">// Get all user defined locals
|
||||||
lower_statement(<span class="kw-2">&mut </span>builder, stmt, <span class="kw-2">&</span>ret_ty)<span class="question-mark">?</span>;
|
</span><span class="kw">for </span>stmt <span class="kw">in </span><span class="kw-2">&</span>func.body.as_ref().unwrap().body {
|
||||||
}
|
<span class="kw">if let </span>ast::Statement::Let(info) = stmt {
|
||||||
|
<span class="kw">let </span>ty = lower_type(<span class="kw-2">&</span>builder.ctx, <span class="kw-2">&</span>info.r#type, builder.local_module)<span class="question-mark">?</span>;
|
||||||
|
builder
|
||||||
|
.name_to_local
|
||||||
|
.insert(info.name.name.clone(), builder.body.locals.len());
|
||||||
|
builder.body.locals.push(Local::new(
|
||||||
|
<span class="prelude-val">Some</span>(info.name.span),
|
||||||
|
LocalKind::Temp,
|
||||||
|
ty,
|
||||||
|
<span class="prelude-val">Some</span>(info.name.name.clone()),
|
||||||
|
info.is_mut,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<span class="kw">if </span>!builder.statements.is_empty() {
|
<span class="kw">for </span>stmt <span class="kw">in </span><span class="kw-2">&</span>func.body.as_ref().unwrap().body {
|
||||||
<span class="kw">let </span>statements = std::mem::take(<span class="kw-2">&mut </span>builder.statements);
|
lower_statement(<span class="kw-2">&mut </span>builder, stmt, <span class="kw-2">&</span>ret_ty)<span class="question-mark">?</span>;
|
||||||
builder.body.blocks.push(BasicBlock {
|
}
|
||||||
statements: statements.into(),
|
|
||||||
terminator: Terminator::Return,
|
|
||||||
terminator_span: <span class="prelude-val">None</span>,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
<span class="kw">if </span>!builder.statements.is_empty() {
|
||||||
|
<span class="kw">let </span>statements = std::mem::take(<span class="kw-2">&mut </span>builder.statements);
|
||||||
|
builder.body.blocks.push(BasicBlock {
|
||||||
|
statements: statements.into(),
|
||||||
|
terminator: Terminator::Return,
|
||||||
|
terminator_span: <span class="prelude-val">None</span>,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
<span class="kw">let </span>(<span class="kw-2">mut </span>ctx, body) = (builder.ctx, builder.body);
|
<span class="kw">let </span>(<span class="kw-2">mut </span>ctx, body) = (builder.ctx, builder.body);
|
||||||
ctx.unresolved_function_signatures.remove(<span class="kw-2">&</span>body.def_id);
|
ctx.unresolved_function_signatures.remove(<span class="kw-2">&</span>body.def_id);
|
||||||
ctx.body.functions.insert(body.def_id, body);
|
ctx.body.functions.insert(body.def_id, body);
|
||||||
|
@ -1712,6 +1718,8 @@
|
||||||
kind: ty,
|
kind: ty,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<span class="macro">dbg!</span>(<span class="string">"here1"</span>);
|
||||||
|
|
||||||
<span class="kw">for _ in </span><span class="number">0</span>..info.deref_times {
|
<span class="kw">for _ in </span><span class="number">0</span>..info.deref_times {
|
||||||
<span class="kw">match </span><span class="kw-2">&</span>ty.kind {
|
<span class="kw">match </span><span class="kw-2">&</span>ty.kind {
|
||||||
TypeKind::Ptr(is_mut, inner) => {
|
TypeKind::Ptr(is_mut, inner) => {
|
||||||
|
@ -1731,8 +1739,12 @@
|
||||||
place.projection.push(PlaceElem::Deref);
|
place.projection.push(PlaceElem::Deref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<span class="macro">dbg!</span>(<span class="string">"here2"</span>);
|
||||||
|
|
||||||
<span class="kw">let </span>(rvalue, _ty, _span) = lower_expr(builder, <span class="kw-2">&</span>info.value, <span class="prelude-val">Some</span>(<span class="kw-2">&</span>ty))<span class="question-mark">?</span>;
|
<span class="kw">let </span>(rvalue, _ty, _span) = lower_expr(builder, <span class="kw-2">&</span>info.value, <span class="prelude-val">Some</span>(<span class="kw-2">&</span>ty))<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="macro">dbg!</span>(<span class="string">"here3"</span>);
|
||||||
|
|
||||||
builder.statements.push(Statement {
|
builder.statements.push(Statement {
|
||||||
span: <span class="prelude-val">Some</span>(info.name.first.span),
|
span: <span class="prelude-val">Some</span>(info.name.first.span),
|
||||||
kind: StatementKind::Assign(place, rvalue),
|
kind: StatementKind::Assign(place, rvalue),
|
||||||
|
@ -2296,8 +2308,6 @@
|
||||||
<span class="kw">let </span>(value, ty, span) = lower_expr(builder, value_expr, <span class="prelude-val">Some</span>(return_type))<span class="question-mark">?</span>;
|
<span class="kw">let </span>(value, ty, span) = lower_expr(builder, value_expr, <span class="prelude-val">Some</span>(return_type))<span class="question-mark">?</span>;
|
||||||
|
|
||||||
<span class="kw">if </span>return_type.kind != ty {
|
<span class="kw">if </span>return_type.kind != ty {
|
||||||
<span class="macro">dbg!</span>(<span class="string">"here"</span>);
|
|
||||||
<span class="macro">dbg!</span>(value);
|
|
||||||
<span class="kw">return </span><span class="prelude-val">Err</span>(LoweringError::UnexpectedType {
|
<span class="kw">return </span><span class="prelude-val">Err</span>(LoweringError::UnexpectedType {
|
||||||
span,
|
span,
|
||||||
found: ty,
|
found: ty,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
138
src/educe/common/bound.rs.html
Normal file
138
src/educe/common/bound.rs.html
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/bound.rs`."><title>bound.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>syn::{punctuated::Punctuated, token::Comma, GenericParam, Meta, Path, Type, WherePredicate};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">crate</span>::common::where_predicates_bool::{
|
||||||
|
create_where_predicates_from_generic_parameters,
|
||||||
|
create_where_predicates_from_generic_parameters_check_types, meta_2_where_predicates,
|
||||||
|
WherePredicates, WherePredicatesOrBool,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">enum </span>Bound {
|
||||||
|
Disabled,
|
||||||
|
Auto,
|
||||||
|
Custom(WherePredicates),
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Bound {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>from_meta(meta: <span class="kw-2">&</span>Meta) -> syn::Result<<span class="self">Self</span>> {
|
||||||
|
<span class="macro">debug_assert!</span>(meta.path().is_ident(<span class="string">"bound"</span>));
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(<span class="kw">match </span>meta_2_where_predicates(meta)<span class="question-mark">? </span>{
|
||||||
|
WherePredicatesOrBool::WherePredicates(where_predicates) => {
|
||||||
|
<span class="self">Self</span>::Custom(where_predicates)
|
||||||
|
},
|
||||||
|
WherePredicatesOrBool::Bool(b) => {
|
||||||
|
<span class="kw">if </span>b {
|
||||||
|
<span class="self">Self</span>::Auto
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="self">Self</span>::Disabled
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Bound {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>into_where_predicates_by_generic_parameters(
|
||||||
|
<span class="self">self</span>,
|
||||||
|
params: <span class="kw-2">&</span>Punctuated<GenericParam, Comma>,
|
||||||
|
bound_trait: <span class="kw-2">&</span>Path,
|
||||||
|
) -> Punctuated<WherePredicate, Comma> {
|
||||||
|
<span class="kw">match </span><span class="self">self </span>{
|
||||||
|
<span class="self">Self</span>::Disabled => Punctuated::new(),
|
||||||
|
<span class="self">Self</span>::Auto => create_where_predicates_from_generic_parameters(params, bound_trait),
|
||||||
|
<span class="self">Self</span>::Custom(where_predicates) => where_predicates,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>into_where_predicates_by_generic_parameters_check_types(
|
||||||
|
<span class="self">self</span>,
|
||||||
|
params: <span class="kw-2">&</span>Punctuated<GenericParam, Comma>,
|
||||||
|
bound_trait: <span class="kw-2">&</span>Path,
|
||||||
|
types: <span class="kw-2">&</span>[<span class="kw-2">&</span>Type],
|
||||||
|
recursive: <span class="prelude-ty">Option</span><(bool, bool, bool)>,
|
||||||
|
) -> Punctuated<WherePredicate, Comma> {
|
||||||
|
<span class="kw">match </span><span class="self">self </span>{
|
||||||
|
<span class="self">Self</span>::Disabled => Punctuated::new(),
|
||||||
|
<span class="self">Self</span>::Auto => create_where_predicates_from_generic_parameters_check_types(
|
||||||
|
params,
|
||||||
|
bound_trait,
|
||||||
|
types,
|
||||||
|
recursive,
|
||||||
|
),
|
||||||
|
<span class="self">Self</span>::Custom(where_predicates) => where_predicates,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
220
src/educe/common/expr.rs.html
Normal file
220
src/educe/common/expr.rs.html
Normal file
|
@ -0,0 +1,220 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/expr.rs`."><title>expr.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::{quote, ToTokens};
|
||||||
|
<span class="kw">use </span>syn::{spanned::Spanned, Expr, Lit, Meta, Type};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">super</span>::path::path_to_string;
|
||||||
|
|
||||||
|
<span class="kw">const </span>INT_TYPES: [<span class="kw-2">&</span>str; <span class="number">12</span>] =
|
||||||
|
[<span class="string">"u8"</span>, <span class="string">"u16"</span>, <span class="string">"u32"</span>, <span class="string">"u64"</span>, <span class="string">"u128"</span>, <span class="string">"usize"</span>, <span class="string">"i8"</span>, <span class="string">"i16"</span>, <span class="string">"i32"</span>, <span class="string">"i64"</span>, <span class="string">"i128"</span>, <span class="string">"isize"</span>];
|
||||||
|
|
||||||
|
<span class="kw">const </span>FLOAT_TYPES: [<span class="kw-2">&</span>str; <span class="number">2</span>] = [<span class="string">"f32"</span>, <span class="string">"f64"</span>];
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_2_expr(meta: <span class="kw-2">&</span>Meta) -> syn::Result<Expr> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>meta {
|
||||||
|
Meta::NameValue(name_value) => <span class="prelude-val">Ok</span>(name_value.value.clone()),
|
||||||
|
Meta::List(list) => list.parse_args::<Expr>(),
|
||||||
|
Meta::Path(path) => <span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
path.span(),
|
||||||
|
<span class="macro">format!</span>(<span class="string">"expected `{path} = Expr` or `{path}(Expr)`"</span>, path = path_to_string(path)),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>auto_adjust_expr(expr: Expr, ty: <span class="prelude-ty">Option</span><<span class="kw-2">&</span>Type>) -> Expr {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>expr {
|
||||||
|
Expr::Lit(lit) => {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>lit.lit {
|
||||||
|
Lit::Int(lit) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(Type::Path(ty)) = ty {
|
||||||
|
<span class="kw">let </span>ty_string = ty.into_token_stream().to_string();
|
||||||
|
|
||||||
|
<span class="kw">if </span>lit.suffix() == ty_string || INT_TYPES.contains(<span class="kw-2">&</span>ty_string.as_str()) {
|
||||||
|
<span class="comment">// don't call into
|
||||||
|
</span><span class="kw">return </span>expr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Lit::Float(lit) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(Type::Path(ty)) = ty {
|
||||||
|
<span class="kw">let </span>ty_string = ty.into_token_stream().to_string();
|
||||||
|
|
||||||
|
<span class="kw">if </span>lit.suffix() == ty_string || FLOAT_TYPES.contains(<span class="kw-2">&</span>ty_string.as_str()) {
|
||||||
|
<span class="comment">// don't call into
|
||||||
|
</span><span class="kw">return </span>expr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Lit::Str(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(Type::Reference(ty)) = ty {
|
||||||
|
<span class="kw">let </span>ty_string = ty.elem.clone().into_token_stream().to_string();
|
||||||
|
|
||||||
|
<span class="kw">if </span>ty_string == <span class="string">"str" </span>{
|
||||||
|
<span class="comment">// don't call into
|
||||||
|
</span><span class="kw">return </span>expr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Lit::Bool(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(Type::Path(ty)) = ty {
|
||||||
|
<span class="kw">let </span>ty_string = ty.into_token_stream().to_string();
|
||||||
|
|
||||||
|
<span class="kw">if </span>ty_string == <span class="string">"bool" </span>{
|
||||||
|
<span class="comment">// don't call into
|
||||||
|
</span><span class="kw">return </span>expr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Lit::Char(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(Type::Path(ty)) = ty {
|
||||||
|
<span class="kw">let </span>ty_string = ty.into_token_stream().to_string();
|
||||||
|
|
||||||
|
<span class="kw">if </span>ty_string == <span class="string">"char" </span>{
|
||||||
|
<span class="comment">// don't call into
|
||||||
|
</span><span class="kw">return </span>expr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Lit::Byte(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(Type::Path(ty)) = ty {
|
||||||
|
<span class="kw">let </span>ty_string = ty.into_token_stream().to_string();
|
||||||
|
|
||||||
|
<span class="kw">if </span>ty_string == <span class="string">"u8" </span>{
|
||||||
|
<span class="comment">// don't call into
|
||||||
|
</span><span class="kw">return </span>expr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Lit::ByteStr(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(Type::Reference(ty)) = ty {
|
||||||
|
<span class="kw">if let </span>Type::Array(ty) = ty.elem.as_ref() {
|
||||||
|
<span class="kw">if let </span>Type::Path(ty) = ty.elem.as_ref() {
|
||||||
|
<span class="kw">let </span>ty_string = ty.into_token_stream().to_string();
|
||||||
|
|
||||||
|
<span class="kw">if </span>ty_string == <span class="string">"u8" </span>{
|
||||||
|
<span class="comment">// don't call into
|
||||||
|
</span><span class="kw">return </span>expr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
|
||||||
|
syn::parse2(<span class="macro">quote!</span>(::core::convert::Into::into(#expr))).unwrap()
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> expr,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
324
src/educe/common/ident_bool.rs.html
Normal file
324
src/educe/common/ident_bool.rs.html
Normal file
|
@ -0,0 +1,324 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/ident_bool.rs`."><title>ident_bool.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
<a href="#136" id="136">136</a>
|
||||||
|
<a href="#137" id="137">137</a>
|
||||||
|
<a href="#138" id="138">138</a>
|
||||||
|
<a href="#139" id="139">139</a>
|
||||||
|
<a href="#140" id="140">140</a>
|
||||||
|
<a href="#141" id="141">141</a>
|
||||||
|
<a href="#142" id="142">142</a>
|
||||||
|
<a href="#143" id="143">143</a>
|
||||||
|
<a href="#144" id="144">144</a>
|
||||||
|
<a href="#145" id="145">145</a>
|
||||||
|
<a href="#146" id="146">146</a>
|
||||||
|
<a href="#147" id="147">147</a>
|
||||||
|
<a href="#148" id="148">148</a>
|
||||||
|
<a href="#149" id="149">149</a>
|
||||||
|
<a href="#150" id="150">150</a>
|
||||||
|
<a href="#151" id="151">151</a>
|
||||||
|
<a href="#152" id="152">152</a>
|
||||||
|
<a href="#153" id="153">153</a>
|
||||||
|
<a href="#154" id="154">154</a>
|
||||||
|
<a href="#155" id="155">155</a>
|
||||||
|
<a href="#156" id="156">156</a>
|
||||||
|
<a href="#157" id="157">157</a>
|
||||||
|
<a href="#158" id="158">158</a>
|
||||||
|
<a href="#159" id="159">159</a>
|
||||||
|
<a href="#160" id="160">160</a>
|
||||||
|
<a href="#161" id="161">161</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>syn::{
|
||||||
|
parse::{Parse, ParseStream},
|
||||||
|
spanned::Spanned,
|
||||||
|
Expr, Ident, Lit, LitBool, LitStr, Meta, MetaNameValue,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">super</span>::path::path_to_string;
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">enum </span>IdentOrBool {
|
||||||
|
Ident(Ident),
|
||||||
|
Bool(bool),
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Parse <span class="kw">for </span>IdentOrBool {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>parse(input: ParseStream) -> syn::Result<<span class="self">Self</span>> {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Ok</span>(lit) = input.parse::<Lit>() {
|
||||||
|
<span class="kw">match </span>lit {
|
||||||
|
Lit::Bool(lit) => <span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="self">Self</span>::Bool(lit.value)),
|
||||||
|
Lit::Str(lit) => {
|
||||||
|
<span class="kw">return match </span>lit.parse::<Ident>() {
|
||||||
|
<span class="prelude-val">Ok</span>(ident) => <span class="prelude-val">Ok</span>(<span class="self">Self</span>::Ident(ident)),
|
||||||
|
<span class="prelude-val">Err</span>(<span class="kw">_</span>) <span class="kw">if </span>lit.value().is_empty() => <span class="prelude-val">Ok</span>(<span class="self">Self</span>::Bool(<span class="bool-val">false</span>)),
|
||||||
|
<span class="prelude-val">Err</span>(error) => <span class="prelude-val">Err</span>(error),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(<span class="self">Self</span>::Ident(input.parse::<Ident>()<span class="question-mark">?</span>))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_name_value_2_ident(name_value: <span class="kw-2">&</span>MetaNameValue) -> syn::Result<Ident> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>name_value.value {
|
||||||
|
Expr::Lit(lit) => {
|
||||||
|
<span class="kw">if let </span>Lit::Str(lit) = <span class="kw-2">&</span>lit.lit {
|
||||||
|
<span class="kw">return </span>lit.parse();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Expr::Path(path) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(ident) = path.path.get_ident() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(ident.clone());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
name_value.value.span(),
|
||||||
|
<span class="macro">format!</span>(<span class="string">"expected `{path} = Ident`"</span>, path = path_to_string(<span class="kw-2">&</span>name_value.path)),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_2_ident(meta: <span class="kw-2">&</span>Meta) -> syn::Result<Ident> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>meta {
|
||||||
|
Meta::NameValue(name_value) => meta_name_value_2_ident(name_value),
|
||||||
|
Meta::List(list) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Ok</span>(lit) = list.parse_args::<LitStr>() {
|
||||||
|
lit.parse()
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
list.parse_args()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Meta::Path(path) => <span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
path.span(),
|
||||||
|
<span class="macro">format!</span>(<span class="string">"expected `{path} = Ident` or `{path}(Ident)`"</span>, path = path_to_string(path)),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_name_value_2_bool(name_value: <span class="kw-2">&</span>MetaNameValue) -> syn::Result<bool> {
|
||||||
|
<span class="kw">if let </span>Expr::Lit(lit) = <span class="kw-2">&</span>name_value.value {
|
||||||
|
<span class="kw">if let </span>Lit::Bool(b) = <span class="kw-2">&</span>lit.lit {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(b.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
name_value.value.span(),
|
||||||
|
<span class="macro">format!</span>(<span class="string">"expected `{path} = false`"</span>, path = path_to_string(<span class="kw-2">&</span>name_value.path)),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_2_bool(meta: <span class="kw-2">&</span>Meta) -> syn::Result<bool> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>meta {
|
||||||
|
Meta::NameValue(name_value) => meta_name_value_2_bool(name_value),
|
||||||
|
Meta::List(list) => <span class="prelude-val">Ok</span>(list.parse_args::<LitBool>()<span class="question-mark">?</span>.value),
|
||||||
|
Meta::Path(path) => <span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
path.span(),
|
||||||
|
<span class="macro">format!</span>(<span class="string">"expected `{path} = false` or `{path}(false)`"</span>, path = path_to_string(path)),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_2_bool_allow_path(meta: <span class="kw-2">&</span>Meta) -> syn::Result<bool> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>meta {
|
||||||
|
Meta::Path(<span class="kw">_</span>) => <span class="prelude-val">Ok</span>(<span class="bool-val">true</span>),
|
||||||
|
Meta::NameValue(name_value) => meta_name_value_2_bool(name_value),
|
||||||
|
Meta::List(list) => <span class="prelude-val">Ok</span>(list.parse_args::<LitBool>()<span class="question-mark">?</span>.value),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_name_value_2_ident_and_bool(
|
||||||
|
name_value: <span class="kw-2">&</span>MetaNameValue,
|
||||||
|
) -> syn::Result<IdentOrBool> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>name_value.value {
|
||||||
|
Expr::Lit(lit) => <span class="kw">match </span><span class="kw-2">&</span>lit.lit {
|
||||||
|
Lit::Str(lit) => <span class="kw">match </span>lit.parse::<Ident>() {
|
||||||
|
<span class="prelude-val">Ok</span>(ident) => <span class="kw">return </span><span class="prelude-val">Ok</span>(IdentOrBool::Ident(ident)),
|
||||||
|
<span class="prelude-val">Err</span>(<span class="kw">_</span>) <span class="kw">if </span>lit.value().is_empty() => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(IdentOrBool::Bool(<span class="bool-val">false</span>));
|
||||||
|
},
|
||||||
|
<span class="prelude-val">Err</span>(error) => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(error);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Lit::Bool(lit) => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(IdentOrBool::Bool(lit.value));
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
},
|
||||||
|
Expr::Path(path) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(ident) = path.path.get_ident() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(IdentOrBool::Ident(ident.clone()));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
name_value.value.span(),
|
||||||
|
<span class="macro">format!</span>(
|
||||||
|
<span class="string">"expected `{path} = Ident` or `{path} = false`"</span>,
|
||||||
|
path = path_to_string(<span class="kw-2">&</span>name_value.path)
|
||||||
|
),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_2_ident_and_bool(meta: <span class="kw-2">&</span>Meta) -> syn::Result<IdentOrBool> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>meta {
|
||||||
|
Meta::NameValue(name_value) => meta_name_value_2_ident_and_bool(name_value),
|
||||||
|
Meta::List(list) => list.parse_args::<IdentOrBool>(),
|
||||||
|
Meta::Path(path) => <span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
path.span(),
|
||||||
|
<span class="macro">format!</span>(
|
||||||
|
<span class="string">"expected `{path} = Ident`, `{path}(Ident)`, `{path} = false`, or `{path}(false)`"</span>,
|
||||||
|
path = path_to_string(path)
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
114
src/educe/common/ident_index.rs.html
Normal file
114
src/educe/common/ident_index.rs.html
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/ident_index.rs`."><title>ident_index.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::ToTokens;
|
||||||
|
<span class="kw">use </span>syn::{Ident, Index};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">enum </span>IdentOrIndex {
|
||||||
|
Ident(Ident),
|
||||||
|
Index(Index),
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>From<Ident> <span class="kw">for </span>IdentOrIndex {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>from(value: Ident) -> <span class="self">Self </span>{
|
||||||
|
<span class="self">Self</span>::Ident(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>From<Index> <span class="kw">for </span>IdentOrIndex {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>from(value: Index) -> <span class="self">Self </span>{
|
||||||
|
<span class="self">Self</span>::Index(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>From<<span class="kw-2">&</span>Ident> <span class="kw">for </span>IdentOrIndex {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>from(value: <span class="kw-2">&</span>Ident) -> <span class="self">Self </span>{
|
||||||
|
<span class="self">Self</span>::Ident(value.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>From<usize> <span class="kw">for </span>IdentOrIndex {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>from(value: usize) -> <span class="self">Self </span>{
|
||||||
|
<span class="self">Self</span>::Index(Index::from(value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>ToTokens <span class="kw">for </span>IdentOrIndex {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>to_tokens(<span class="kw-2">&</span><span class="self">self</span>, token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream) {
|
||||||
|
<span class="kw">match </span><span class="self">self </span>{
|
||||||
|
<span class="self">Self</span>::Ident(ident) => ToTokens::to_tokens(ident, token_stream),
|
||||||
|
<span class="self">Self</span>::Index(index) => ToTokens::to_tokens(index, token_stream),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>IdentOrIndex {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>from_ident_with_index(ident: <span class="prelude-ty">Option</span><<span class="kw-2">&</span>Ident>, index: usize) -> IdentOrIndex {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(ident) = ident {
|
||||||
|
<span class="self">Self</span>::from(ident)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="self">Self</span>::from(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
128
src/educe/common/int.rs.html
Normal file
128
src/educe/common/int.rs.html
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/int.rs`."><title>int.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>syn::{spanned::Spanned, Expr, Lit, Meta, MetaNameValue, UnOp};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">super</span>::path::path_to_string;
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_name_value_2_isize(name_value: <span class="kw-2">&</span>MetaNameValue) -> syn::Result<isize> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>name_value.value {
|
||||||
|
Expr::Lit(lit) => <span class="kw">match </span><span class="kw-2">&</span>lit.lit {
|
||||||
|
Lit::Str(lit) => {
|
||||||
|
<span class="kw">return </span>lit
|
||||||
|
.value()
|
||||||
|
.parse::<isize>()
|
||||||
|
.map_err(|error| syn::Error::new(lit.span(), error))
|
||||||
|
},
|
||||||
|
Lit::Int(lit) => <span class="kw">return </span>lit.base10_parse(),
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
},
|
||||||
|
Expr::Unary(unary) => {
|
||||||
|
<span class="kw">if let </span>UnOp::Neg(<span class="kw">_</span>) = unary.op {
|
||||||
|
<span class="kw">if let </span>Expr::Lit(lit) = unary.expr.as_ref() {
|
||||||
|
<span class="kw">if let </span>Lit::Int(lit) = <span class="kw-2">&</span>lit.lit {
|
||||||
|
<span class="kw">let </span>s = <span class="macro">format!</span>(<span class="string">"-{}"</span>, lit.base10_digits());
|
||||||
|
|
||||||
|
<span class="kw">return </span>s
|
||||||
|
.parse::<isize>()
|
||||||
|
.map_err(|error| syn::Error::new(lit.span(), error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
name_value.value.span(),
|
||||||
|
<span class="macro">format!</span>(<span class="string">"expected `{path} = integer`"</span>, path = path_to_string(<span class="kw-2">&</span>name_value.path)),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_2_isize(meta: <span class="kw-2">&</span>Meta) -> syn::Result<isize> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>meta {
|
||||||
|
Meta::NameValue(name_value) => meta_name_value_2_isize(name_value),
|
||||||
|
Meta::List(list) => {
|
||||||
|
<span class="kw">let </span>lit = list.parse_args::<Lit>()<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>lit {
|
||||||
|
Lit::Str(lit) => {
|
||||||
|
lit.value().parse::<isize>().map_err(|error| syn::Error::new(lit.span(), error))
|
||||||
|
},
|
||||||
|
Lit::Int(lit) => lit.base10_parse(),
|
||||||
|
<span class="kw">_ </span>=> <span class="prelude-val">Err</span>(syn::Error::new(lit.span(), <span class="string">"not an integer"</span>)),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Meta::Path(path) => <span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
path.span(),
|
||||||
|
<span class="macro">format!</span>(
|
||||||
|
<span class="string">"expected `{path} = integer` or `{path}(integer)`"</span>,
|
||||||
|
path = path_to_string(path)
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
88
src/educe/common/mod.rs.html
Normal file
88
src/educe/common/mod.rs.html
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/mod.rs`."><title>mod.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="attr">#[allow(dead_code)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>bound;
|
||||||
|
<span class="attr">#[allow(dead_code)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>path;
|
||||||
|
<span class="attr">#[allow(dead_code)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>r#type;
|
||||||
|
<span class="attr">#[allow(dead_code)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>where_predicates_bool;
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Default"</span>)]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>expr;
|
||||||
|
<span class="attr">#[cfg(any(
|
||||||
|
feature = <span class="string">"Debug"</span>,
|
||||||
|
feature = <span class="string">"PartialEq"</span>,
|
||||||
|
feature = <span class="string">"PartialOrd"</span>,
|
||||||
|
feature = <span class="string">"Ord"</span>,
|
||||||
|
feature = <span class="string">"Hash"</span>,
|
||||||
|
feature = <span class="string">"Default"
|
||||||
|
</span>))]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>ident_bool;
|
||||||
|
<span class="attr">#[cfg(any(
|
||||||
|
feature = <span class="string">"Debug"</span>,
|
||||||
|
feature = <span class="string">"PartialEq"</span>,
|
||||||
|
feature = <span class="string">"PartialOrd"</span>,
|
||||||
|
feature = <span class="string">"Ord"</span>,
|
||||||
|
feature = <span class="string">"Hash"</span>,
|
||||||
|
feature = <span class="string">"Deref"</span>,
|
||||||
|
feature = <span class="string">"DerefMut"</span>,
|
||||||
|
feature = <span class="string">"Into"
|
||||||
|
</span>))]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>ident_index;
|
||||||
|
<span class="attr">#[cfg(any(feature = <span class="string">"PartialOrd"</span>, feature = <span class="string">"Ord"</span>))]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>int;
|
||||||
|
<span class="attr">#[cfg(any(feature = <span class="string">"Debug"</span>, feature = <span class="string">"PartialEq"</span>, feature = <span class="string">"Hash"</span>))]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>unsafe_punctuated_meta;
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(any(feature = <span class="string">"PartialOrd"</span>, feature = <span class="string">"Ord"</span>, feature = <span class="string">"Into"</span>))]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">mod </span>tools;
|
||||||
|
</code></pre></div></section></main></body></html>
|
88
src/educe/common/path.rs.html
Normal file
88
src/educe/common/path.rs.html
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/path.rs`."><title>path.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::ToTokens;
|
||||||
|
<span class="kw">use </span>syn::{spanned::Spanned, Expr, Lit, LitStr, Meta, MetaNameValue, Path};
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_name_value_2_path(name_value: <span class="kw-2">&</span>MetaNameValue) -> syn::Result<Path> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>name_value.value {
|
||||||
|
Expr::Lit(lit) => {
|
||||||
|
<span class="kw">if let </span>Lit::Str(lit) = <span class="kw-2">&</span>lit.lit {
|
||||||
|
<span class="kw">return </span>lit.parse();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Expr::Path(path) => <span class="kw">return </span><span class="prelude-val">Ok</span>(path.path.clone()),
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
name_value.value.span(),
|
||||||
|
<span class="macro">format!</span>(<span class="string">"expected `{path} = Path`"</span>, path = path_to_string(<span class="kw-2">&</span>name_value.path)),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_2_path(meta: <span class="kw-2">&</span>Meta) -> syn::Result<Path> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>meta {
|
||||||
|
Meta::NameValue(name_value) => meta_name_value_2_path(name_value),
|
||||||
|
Meta::List(list) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Ok</span>(lit) = list.parse_args::<LitStr>() {
|
||||||
|
lit.parse()
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
list.parse_args()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Meta::Path(path) => <span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
path.span(),
|
||||||
|
<span class="macro">format!</span>(<span class="string">"expected `{path} = Path` or `{path}(Path)`"</span>, path = path_to_string(path)),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>path_to_string(path: <span class="kw-2">&</span>Path) -> String {
|
||||||
|
path.into_token_stream().to_string().replace(<span class="string">' '</span>, <span class="string">""</span>)
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
340
src/educe/common/tools/discriminant_type.rs.html
Normal file
340
src/educe/common/tools/discriminant_type.rs.html
Normal file
|
@ -0,0 +1,340 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/tools/discriminant_type.rs`."><title>discriminant_type.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
<a href="#136" id="136">136</a>
|
||||||
|
<a href="#137" id="137">137</a>
|
||||||
|
<a href="#138" id="138">138</a>
|
||||||
|
<a href="#139" id="139">139</a>
|
||||||
|
<a href="#140" id="140">140</a>
|
||||||
|
<a href="#141" id="141">141</a>
|
||||||
|
<a href="#142" id="142">142</a>
|
||||||
|
<a href="#143" id="143">143</a>
|
||||||
|
<a href="#144" id="144">144</a>
|
||||||
|
<a href="#145" id="145">145</a>
|
||||||
|
<a href="#146" id="146">146</a>
|
||||||
|
<a href="#147" id="147">147</a>
|
||||||
|
<a href="#148" id="148">148</a>
|
||||||
|
<a href="#149" id="149">149</a>
|
||||||
|
<a href="#150" id="150">150</a>
|
||||||
|
<a href="#151" id="151">151</a>
|
||||||
|
<a href="#152" id="152">152</a>
|
||||||
|
<a href="#153" id="153">153</a>
|
||||||
|
<a href="#154" id="154">154</a>
|
||||||
|
<a href="#155" id="155">155</a>
|
||||||
|
<a href="#156" id="156">156</a>
|
||||||
|
<a href="#157" id="157">157</a>
|
||||||
|
<a href="#158" id="158">158</a>
|
||||||
|
<a href="#159" id="159">159</a>
|
||||||
|
<a href="#160" id="160">160</a>
|
||||||
|
<a href="#161" id="161">161</a>
|
||||||
|
<a href="#162" id="162">162</a>
|
||||||
|
<a href="#163" id="163">163</a>
|
||||||
|
<a href="#164" id="164">164</a>
|
||||||
|
<a href="#165" id="165">165</a>
|
||||||
|
<a href="#166" id="166">166</a>
|
||||||
|
<a href="#167" id="167">167</a>
|
||||||
|
<a href="#168" id="168">168</a>
|
||||||
|
<a href="#169" id="169">169</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>proc_macro2::{Ident, Span, TokenStream};
|
||||||
|
<span class="kw">use </span>quote::{ToTokens, TokenStreamExt};
|
||||||
|
<span class="kw">use </span>syn::{
|
||||||
|
punctuated::Punctuated, spanned::Spanned, Data, DeriveInput, Expr, Lit, Meta, Token, UnOp,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">enum </span>DiscriminantType {
|
||||||
|
ISize,
|
||||||
|
I8,
|
||||||
|
I16,
|
||||||
|
I32,
|
||||||
|
I64,
|
||||||
|
I128,
|
||||||
|
USize,
|
||||||
|
U8,
|
||||||
|
U16,
|
||||||
|
U32,
|
||||||
|
U64,
|
||||||
|
U128,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>DiscriminantType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>parse_str<S: AsRef<str>>(s: S) -> <span class="prelude-ty">Option</span><<span class="self">Self</span>> {
|
||||||
|
<span class="kw">match </span>s.as_ref() {
|
||||||
|
<span class="string">"i8" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::I8),
|
||||||
|
<span class="string">"i16" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::I16),
|
||||||
|
<span class="string">"i32" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::I32),
|
||||||
|
<span class="string">"i64" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::I64),
|
||||||
|
<span class="string">"i128" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::I128),
|
||||||
|
<span class="string">"isize" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::ISize),
|
||||||
|
<span class="string">"u8" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::U8),
|
||||||
|
<span class="string">"u16" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::U16),
|
||||||
|
<span class="string">"u32" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::U32),
|
||||||
|
<span class="string">"u64" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::U64),
|
||||||
|
<span class="string">"u128" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::U128),
|
||||||
|
<span class="string">"usize" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::USize),
|
||||||
|
<span class="kw">_ </span>=> <span class="prelude-val">None</span>,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">const fn </span>as_str(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="lifetime">'static </span>str {
|
||||||
|
<span class="kw">match </span><span class="self">self </span>{
|
||||||
|
<span class="self">Self</span>::ISize => <span class="string">"isize"</span>,
|
||||||
|
<span class="self">Self</span>::I8 => <span class="string">"i8"</span>,
|
||||||
|
<span class="self">Self</span>::I16 => <span class="string">"i16"</span>,
|
||||||
|
<span class="self">Self</span>::I32 => <span class="string">"i32"</span>,
|
||||||
|
<span class="self">Self</span>::I64 => <span class="string">"i64"</span>,
|
||||||
|
<span class="self">Self</span>::I128 => <span class="string">"i128"</span>,
|
||||||
|
<span class="self">Self</span>::USize => <span class="string">"usize"</span>,
|
||||||
|
<span class="self">Self</span>::U8 => <span class="string">"u8"</span>,
|
||||||
|
<span class="self">Self</span>::U16 => <span class="string">"u16"</span>,
|
||||||
|
<span class="self">Self</span>::U32 => <span class="string">"u32"</span>,
|
||||||
|
<span class="self">Self</span>::U64 => <span class="string">"u64"</span>,
|
||||||
|
<span class="self">Self</span>::U128 => <span class="string">"u128"</span>,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>ToTokens <span class="kw">for </span>DiscriminantType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>to_tokens(<span class="kw-2">&</span><span class="self">self</span>, tokens: <span class="kw-2">&mut </span>TokenStream) {
|
||||||
|
tokens.append(Ident::new(<span class="self">self</span>.as_str(), Span::call_site()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>DiscriminantType {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>from_ast(ast: <span class="kw-2">&</span>DeriveInput) -> syn::Result<<span class="self">Self</span>> {
|
||||||
|
<span class="kw">if let </span>Data::Enum(data) = <span class="kw-2">&</span>ast.data {
|
||||||
|
<span class="kw">for </span>attr <span class="kw">in </span>ast.attrs.iter() {
|
||||||
|
<span class="kw">if </span>attr.path().is_ident(<span class="string">"repr"</span>) {
|
||||||
|
<span class="comment">// #[repr(u8)], #[repr(u16)], ..., etc.
|
||||||
|
</span><span class="kw">if let </span>Meta::List(list) = <span class="kw-2">&</span>attr.meta {
|
||||||
|
<span class="kw">let </span>result =
|
||||||
|
list.parse_args_with(Punctuated::<Ident, <span class="macro">Token!</span>[,]>::parse_terminated)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(value) = result.into_iter().next() {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(t) = <span class="self">Self</span>::parse_str(value.to_string()) {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>min = i128::MAX;
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>max = i128::MIN;
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>counter = <span class="number">0i128</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>variant <span class="kw">in </span>data.variants.iter() {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>((<span class="kw">_</span>, exp)) = variant.discriminant.as_ref() {
|
||||||
|
<span class="kw">match </span>exp {
|
||||||
|
Expr::Lit(lit) => {
|
||||||
|
<span class="kw">if let </span>Lit::Int(lit) = <span class="kw-2">&</span>lit.lit {
|
||||||
|
counter = lit
|
||||||
|
.base10_parse()
|
||||||
|
.map_err(|error| syn::Error::new(lit.span(), error))<span class="question-mark">?</span>;
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(syn::Error::new(lit.span(), <span class="string">"not an integer"</span>));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Expr::Unary(unary) => {
|
||||||
|
<span class="kw">if let </span>UnOp::Neg(<span class="kw">_</span>) = unary.op {
|
||||||
|
<span class="kw">if let </span>Expr::Lit(lit) = unary.expr.as_ref() {
|
||||||
|
<span class="kw">if let </span>Lit::Int(lit) = <span class="kw-2">&</span>lit.lit {
|
||||||
|
<span class="kw">match </span>lit.base10_parse::<i128>() {
|
||||||
|
<span class="prelude-val">Ok</span>(i) => {
|
||||||
|
counter = -i;
|
||||||
|
},
|
||||||
|
<span class="prelude-val">Err</span>(error) => {
|
||||||
|
<span class="comment">// overflow
|
||||||
|
</span><span class="kw">if </span>lit.base10_digits()
|
||||||
|
== <span class="string">"170141183460469231731687303715884105728"
|
||||||
|
</span>{
|
||||||
|
counter = i128::MIN;
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(syn::Error::new(lit.span(), error));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(syn::Error::new(lit.span(), <span class="string">"not an integer"</span>));
|
||||||
|
}
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
unary.expr.span(),
|
||||||
|
<span class="string">"not a literal"</span>,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
unary.op.span(),
|
||||||
|
<span class="string">"this operation is not allow here"</span>,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> <span class="kw">return </span><span class="prelude-val">Err</span>(syn::Error::new(exp.span(), <span class="string">"not a literal"</span>)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>min > counter {
|
||||||
|
min = counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>max < counter {
|
||||||
|
max = counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
counter = counter.saturating_add(<span class="number">1</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(<span class="kw">if </span>min >= i8::MIN <span class="kw">as </span>i128 && max <= i8::MAX <span class="kw">as </span>i128 {
|
||||||
|
<span class="self">Self</span>::I8
|
||||||
|
} <span class="kw">else if </span>min >= i16::MIN <span class="kw">as </span>i128 && max <= i16::MAX <span class="kw">as </span>i128 {
|
||||||
|
<span class="self">Self</span>::I16
|
||||||
|
} <span class="kw">else if </span>min >= i32::MIN <span class="kw">as </span>i128 && max <= i32::MAX <span class="kw">as </span>i128 {
|
||||||
|
<span class="self">Self</span>::I32
|
||||||
|
} <span class="kw">else if </span>min >= i64::MIN <span class="kw">as </span>i128 && max <= i64::MAX <span class="kw">as </span>i128 {
|
||||||
|
<span class="self">Self</span>::I64
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="self">Self</span>::I128
|
||||||
|
})
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="prelude-val">Err</span>(syn::Error::new(ast.span(), <span class="string">"not an enum"</span>))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
202
src/educe/common/tools/hash_type.rs.html
Normal file
202
src/educe/common/tools/hash_type.rs.html
Normal file
|
@ -0,0 +1,202 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/tools/hash_type.rs`."><title>hash_type.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>std::{
|
||||||
|
cmp::Ordering,
|
||||||
|
fmt::{<span class="self">self</span>, Display, Formatter},
|
||||||
|
hash::{Hash, Hasher},
|
||||||
|
str::FromStr,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">use </span>proc_macro2::Span;
|
||||||
|
<span class="kw">use </span>quote::ToTokens;
|
||||||
|
<span class="kw">use </span>syn::{spanned::Spanned, Path, Type};
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug, Clone)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>HashType(String, Span);
|
||||||
|
|
||||||
|
<span class="kw">impl </span>PartialEq <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>eq(<span class="kw-2">&</span><span class="self">self</span>, other: <span class="kw-2">&</span><span class="self">Self</span>) -> bool {
|
||||||
|
<span class="self">self</span>.<span class="number">0</span>.eq(<span class="kw-2">&</span>other.<span class="number">0</span>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Eq <span class="kw">for </span>HashType {}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>PartialOrd <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>partial_cmp(<span class="kw-2">&</span><span class="self">self</span>, other: <span class="kw-2">&</span><span class="self">Self</span>) -> <span class="prelude-ty">Option</span><Ordering> {
|
||||||
|
<span class="prelude-val">Some</span>(<span class="self">self</span>.cmp(other))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Ord <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>cmp(<span class="kw-2">&</span><span class="self">self</span>, other: <span class="kw-2">&</span><span class="self">Self</span>) -> Ordering {
|
||||||
|
<span class="self">self</span>.<span class="number">0</span>.cmp(<span class="kw-2">&</span>other.<span class="number">0</span>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Hash <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>hash<H: Hasher>(<span class="kw-2">&</span><span class="self">self</span>, state: <span class="kw-2">&mut </span>H) {
|
||||||
|
Hash::hash(<span class="kw-2">&</span><span class="self">self</span>.<span class="number">0</span>, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Display <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>Formatter<<span class="lifetime">'_</span>>) -> fmt::Result {
|
||||||
|
Display::fmt(<span class="kw-2">&</span><span class="self">self</span>.<span class="number">0</span>.replace(<span class="string">"& '"</span>, <span class="string">"&'"</span>), f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>From<Type> <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>from(value: Type) -> <span class="self">Self </span>{
|
||||||
|
<span class="self">Self</span>::from(<span class="kw-2">&</span>value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>From<<span class="kw-2">&</span>Type> <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>from(value: <span class="kw-2">&</span>Type) -> <span class="self">Self </span>{
|
||||||
|
<span class="self">Self</span>(value.into_token_stream().to_string(), value.span())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>From<Path> <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>from(value: Path) -> <span class="self">Self </span>{
|
||||||
|
<span class="self">Self</span>::from(<span class="kw-2">&</span>value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>From<<span class="kw-2">&</span>Path> <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>from(value: <span class="kw-2">&</span>Path) -> <span class="self">Self </span>{
|
||||||
|
<span class="self">Self</span>(value.into_token_stream().to_string(), value.span())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[allow(dead_code)]
|
||||||
|
</span><span class="kw">impl </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>to_type(<span class="kw-2">&</span><span class="self">self</span>) -> Type {
|
||||||
|
syn::parse_str(<span class="self">self</span>.<span class="number">0</span>.as_str()).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>span(<span class="kw-2">&</span><span class="self">self</span>) -> Span {
|
||||||
|
<span class="self">self</span>.<span class="number">1
|
||||||
|
</span>}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>ToTokens <span class="kw">for </span>HashType {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>to_tokens(<span class="kw-2">&</span><span class="self">self</span>, token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream) {
|
||||||
|
<span class="kw">let </span>ty = proc_macro2::TokenStream::from_str(<span class="self">self</span>.<span class="number">0</span>.as_str()).unwrap();
|
||||||
|
|
||||||
|
token_stream.extend(ty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
24
src/educe/common/tools/mod.rs.html
Normal file
24
src/educe/common/tools/mod.rs.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/tools/mod.rs`."><title>mod.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="attr">#[cfg(any(feature = <span class="string">"PartialOrd"</span>, feature = <span class="string">"Ord"</span>))]
|
||||||
|
</span><span class="kw">mod </span>discriminant_type;
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(any(feature = <span class="string">"PartialOrd"</span>, feature = <span class="string">"Ord"</span>))]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">use </span>discriminant_type::<span class="kw-2">*</span>;
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Into"</span>)]
|
||||||
|
</span><span class="kw">mod </span>hash_type;
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Into"</span>)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">use </span>hash_type::<span class="kw-2">*</span>;
|
||||||
|
</code></pre></div></section></main></body></html>
|
326
src/educe/common/type.rs.html
Normal file
326
src/educe/common/type.rs.html
Normal file
|
@ -0,0 +1,326 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/type.rs`."><title>type.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
<a href="#136" id="136">136</a>
|
||||||
|
<a href="#137" id="137">137</a>
|
||||||
|
<a href="#138" id="138">138</a>
|
||||||
|
<a href="#139" id="139">139</a>
|
||||||
|
<a href="#140" id="140">140</a>
|
||||||
|
<a href="#141" id="141">141</a>
|
||||||
|
<a href="#142" id="142">142</a>
|
||||||
|
<a href="#143" id="143">143</a>
|
||||||
|
<a href="#144" id="144">144</a>
|
||||||
|
<a href="#145" id="145">145</a>
|
||||||
|
<a href="#146" id="146">146</a>
|
||||||
|
<a href="#147" id="147">147</a>
|
||||||
|
<a href="#148" id="148">148</a>
|
||||||
|
<a href="#149" id="149">149</a>
|
||||||
|
<a href="#150" id="150">150</a>
|
||||||
|
<a href="#151" id="151">151</a>
|
||||||
|
<a href="#152" id="152">152</a>
|
||||||
|
<a href="#153" id="153">153</a>
|
||||||
|
<a href="#154" id="154">154</a>
|
||||||
|
<a href="#155" id="155">155</a>
|
||||||
|
<a href="#156" id="156">156</a>
|
||||||
|
<a href="#157" id="157">157</a>
|
||||||
|
<a href="#158" id="158">158</a>
|
||||||
|
<a href="#159" id="159">159</a>
|
||||||
|
<a href="#160" id="160">160</a>
|
||||||
|
<a href="#161" id="161">161</a>
|
||||||
|
<a href="#162" id="162">162</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>std::collections::HashSet;
|
||||||
|
|
||||||
|
<span class="kw">use </span>syn::{
|
||||||
|
parse::{Parse, ParseStream},
|
||||||
|
punctuated::Punctuated,
|
||||||
|
GenericArgument, Ident, Meta, Path, PathArguments, Token, Type, TypeParamBound,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>TypeWithPunctuatedMeta {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) ty: Type,
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) list: Punctuated<Meta, <span class="macro">Token!</span>[,]>,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Parse <span class="kw">for </span>TypeWithPunctuatedMeta {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>parse(input: ParseStream) -> syn::Result<<span class="self">Self</span>> {
|
||||||
|
<span class="kw">let </span>ty = input.parse::<Type>()<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>input.is_empty() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="self">Self </span>{
|
||||||
|
ty,
|
||||||
|
list: Punctuated::new(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
input.parse::<<span class="macro">Token!</span>[,]>()<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span>list = input.parse_terminated(Meta::parse, <span class="macro">Token!</span>[,])<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(<span class="self">Self </span>{
|
||||||
|
ty,
|
||||||
|
list,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="doccomment">/// recursive (dereference, de_ptr, de_param)
|
||||||
|
</span><span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>find_idents_in_path<<span class="lifetime">'a</span>>(
|
||||||
|
set: <span class="kw-2">&mut </span>HashSet<<span class="kw-2">&</span><span class="lifetime">'a </span>Ident>,
|
||||||
|
path: <span class="kw-2">&</span><span class="lifetime">'a </span>Path,
|
||||||
|
recursive: <span class="prelude-ty">Option</span><(bool, bool, bool)>,
|
||||||
|
) {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>((<span class="kw">_</span>, <span class="kw">_</span>, de_param)) = recursive {
|
||||||
|
<span class="kw">if </span>de_param {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(segment) = path.segments.iter().last() {
|
||||||
|
<span class="kw">if let </span>PathArguments::AngleBracketed(a) = <span class="kw-2">&</span>segment.arguments {
|
||||||
|
<span class="comment">// the ident is definitely not a generic parameter, so we don't insert it
|
||||||
|
|
||||||
|
</span><span class="kw">for </span>arg <span class="kw">in </span>a.args.iter() {
|
||||||
|
<span class="kw">match </span>arg {
|
||||||
|
GenericArgument::Type(ty) => {
|
||||||
|
find_idents_in_type(set, ty, recursive);
|
||||||
|
},
|
||||||
|
GenericArgument::AssocType(ty) => {
|
||||||
|
find_idents_in_type(set, <span class="kw-2">&</span>ty.ty, recursive);
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">return</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(ty) = path.get_ident() {
|
||||||
|
set.insert(ty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="doccomment">/// recursive (dereference, de_ptr, de_param)
|
||||||
|
</span><span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>find_idents_in_type<<span class="lifetime">'a</span>>(
|
||||||
|
set: <span class="kw-2">&mut </span>HashSet<<span class="kw-2">&</span><span class="lifetime">'a </span>Ident>,
|
||||||
|
ty: <span class="kw-2">&</span><span class="lifetime">'a </span>Type,
|
||||||
|
recursive: <span class="prelude-ty">Option</span><(bool, bool, bool)>,
|
||||||
|
) {
|
||||||
|
<span class="kw">match </span>ty {
|
||||||
|
Type::Array(ty) => {
|
||||||
|
<span class="kw">if </span>recursive.is_some() {
|
||||||
|
find_idents_in_type(set, ty.elem.as_ref(), recursive);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Type::Group(ty) => {
|
||||||
|
<span class="kw">if </span>recursive.is_some() {
|
||||||
|
find_idents_in_type(set, ty.elem.as_ref(), recursive);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Type::ImplTrait(ty) => {
|
||||||
|
<span class="comment">// always recursive
|
||||||
|
</span><span class="kw">for </span>b <span class="kw">in </span><span class="kw-2">&</span>ty.bounds {
|
||||||
|
<span class="kw">if let </span>TypeParamBound::Trait(ty) = b {
|
||||||
|
find_idents_in_path(set, <span class="kw-2">&</span>ty.path, recursive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Type::Macro(ty) => {
|
||||||
|
<span class="kw">if </span>recursive.is_some() {
|
||||||
|
find_idents_in_path(set, <span class="kw-2">&</span>ty.mac.path, recursive);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Type::Paren(ty) => {
|
||||||
|
<span class="kw">if </span>recursive.is_some() {
|
||||||
|
find_idents_in_type(set, ty.elem.as_ref(), recursive);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Type::Path(ty) => {
|
||||||
|
find_idents_in_path(set, <span class="kw-2">&</span>ty.path, recursive);
|
||||||
|
},
|
||||||
|
Type::Ptr(ty) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>((<span class="kw">_</span>, <span class="bool-val">true</span>, <span class="kw">_</span>)) = recursive {
|
||||||
|
find_idents_in_type(set, ty.elem.as_ref(), recursive);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Type::Reference(ty) => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>((<span class="bool-val">true</span>, ..)) = recursive {
|
||||||
|
find_idents_in_type(set, ty.elem.as_ref(), recursive);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Type::Slice(ty) => {
|
||||||
|
<span class="kw">if </span>recursive.is_some() {
|
||||||
|
find_idents_in_type(set, ty.elem.as_ref(), recursive);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Type::TraitObject(ty) => {
|
||||||
|
<span class="comment">// always recursive
|
||||||
|
</span><span class="kw">for </span>b <span class="kw">in </span><span class="kw-2">&</span>ty.bounds {
|
||||||
|
<span class="kw">if let </span>TypeParamBound::Trait(ty) = b {
|
||||||
|
find_idents_in_path(set, <span class="kw-2">&</span>ty.path, recursive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Type::Tuple(ty) => {
|
||||||
|
<span class="kw">if </span>recursive.is_some() {
|
||||||
|
<span class="kw">for </span>ty <span class="kw">in </span><span class="kw-2">&</span>ty.elems {
|
||||||
|
find_idents_in_type(set, ty, recursive)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>dereference(ty: <span class="kw-2">&</span>Type) -> <span class="kw-2">&</span>Type {
|
||||||
|
<span class="kw">if let </span>Type::Reference(ty) = ty {
|
||||||
|
dereference(ty.elem.as_ref())
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
ty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>dereference_changed(ty: <span class="kw-2">&</span>Type) -> (<span class="kw-2">&</span>Type, bool) {
|
||||||
|
<span class="kw">if let </span>Type::Reference(ty) = ty {
|
||||||
|
(dereference(ty.elem.as_ref()), <span class="bool-val">true</span>)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
(ty, <span class="bool-val">false</span>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
72
src/educe/common/unsafe_punctuated_meta.rs.html
Normal file
72
src/educe/common/unsafe_punctuated_meta.rs.html
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/unsafe_punctuated_meta.rs`."><title>unsafe_punctuated_meta.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>syn::{
|
||||||
|
parse::{Parse, ParseStream},
|
||||||
|
punctuated::Punctuated,
|
||||||
|
Meta, Token,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>UnsafePunctuatedMeta {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) list: Punctuated<Meta, <span class="macro">Token!</span>[,]>,
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) has_unsafe: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Parse <span class="kw">for </span>UnsafePunctuatedMeta {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>parse(input: ParseStream) -> syn::Result<<span class="self">Self</span>> {
|
||||||
|
<span class="kw">let </span>has_unsafe = input.parse::<<span class="macro">Token!</span>[<span class="kw">unsafe</span>]>().is_ok();
|
||||||
|
|
||||||
|
<span class="kw">if </span>input.is_empty() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="self">Self </span>{
|
||||||
|
list: Punctuated::new(),
|
||||||
|
has_unsafe,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>has_unsafe {
|
||||||
|
input.parse::<<span class="macro">Token!</span>[,]>()<span class="question-mark">?</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>list = input.parse_terminated(Meta::parse, <span class="macro">Token!</span>[,])<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(<span class="self">Self </span>{
|
||||||
|
list,
|
||||||
|
has_unsafe,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
272
src/educe/common/where_predicates_bool.rs.html
Normal file
272
src/educe/common/where_predicates_bool.rs.html
Normal file
|
@ -0,0 +1,272 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/common/where_predicates_bool.rs`."><title>where_predicates_bool.rs - source</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="educe" 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="../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>std::collections::HashSet;
|
||||||
|
|
||||||
|
<span class="kw">use </span>quote::{quote, ToTokens};
|
||||||
|
<span class="kw">use </span>syn::{
|
||||||
|
parse::{Parse, ParseStream},
|
||||||
|
punctuated::Punctuated,
|
||||||
|
spanned::Spanned,
|
||||||
|
token::Comma,
|
||||||
|
Expr, GenericParam, Lit, Meta, MetaNameValue, Path, Token, Type, WherePredicate,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">use super</span>::{path::path_to_string, r#type::find_idents_in_type};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">type </span>WherePredicates = Punctuated<WherePredicate, <span class="macro">Token!</span>[,]>;
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">enum </span>WherePredicatesOrBool {
|
||||||
|
WherePredicates(WherePredicates),
|
||||||
|
Bool(bool),
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Parse <span class="kw">for </span>WherePredicatesOrBool {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>parse(input: ParseStream) -> syn::Result<<span class="self">Self</span>> {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Ok</span>(lit) = input.parse::<Lit>() {
|
||||||
|
<span class="kw">match </span>lit {
|
||||||
|
Lit::Bool(lit) => <span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="self">Self</span>::Bool(lit.value)),
|
||||||
|
Lit::Str(lit) => {
|
||||||
|
<span class="kw">return match </span>lit.parse_with(WherePredicates::parse_terminated) {
|
||||||
|
<span class="prelude-val">Ok</span>(where_predicates) => <span class="prelude-val">Ok</span>(<span class="self">Self</span>::WherePredicates(where_predicates)),
|
||||||
|
<span class="prelude-val">Err</span>(<span class="kw">_</span>) <span class="kw">if </span>lit.value().is_empty() => <span class="prelude-val">Ok</span>(<span class="self">Self</span>::Bool(<span class="bool-val">false</span>)),
|
||||||
|
<span class="prelude-val">Err</span>(error) => <span class="prelude-val">Err</span>(error),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(<span class="self">Self</span>::WherePredicates(input.parse_terminated(WherePredicate::parse, <span class="macro">Token!</span>[,])<span class="question-mark">?</span>))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_name_value_2_where_predicates_bool(
|
||||||
|
name_value: <span class="kw-2">&</span>MetaNameValue,
|
||||||
|
) -> syn::Result<WherePredicatesOrBool> {
|
||||||
|
<span class="kw">if let </span>Expr::Lit(lit) = <span class="kw-2">&</span>name_value.value {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>lit.lit {
|
||||||
|
Lit::Str(lit) => <span class="kw">match </span>lit.parse_with(WherePredicates::parse_terminated) {
|
||||||
|
<span class="prelude-val">Ok</span>(where_predicates) => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(WherePredicatesOrBool::WherePredicates(where_predicates))
|
||||||
|
},
|
||||||
|
<span class="prelude-val">Err</span>(<span class="kw">_</span>) <span class="kw">if </span>lit.value().is_empty() => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(WherePredicatesOrBool::Bool(<span class="bool-val">false</span>));
|
||||||
|
},
|
||||||
|
<span class="prelude-val">Err</span>(error) => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(error);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Lit::Bool(lit) => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(WherePredicatesOrBool::Bool(lit.value));
|
||||||
|
},
|
||||||
|
<span class="kw">_ </span>=> (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
name_value.value.span(),
|
||||||
|
<span class="macro">format!</span>(
|
||||||
|
<span class="string">"expected `{path} = \"where_predicates\"` or `{path} = false`"</span>,
|
||||||
|
path = path_to_string(<span class="kw-2">&</span>name_value.path)
|
||||||
|
),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>meta_2_where_predicates(meta: <span class="kw-2">&</span>Meta) -> syn::Result<WherePredicatesOrBool> {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>meta {
|
||||||
|
Meta::NameValue(name_value) => meta_name_value_2_where_predicates_bool(name_value),
|
||||||
|
Meta::List(list) => list.parse_args::<WherePredicatesOrBool>(),
|
||||||
|
Meta::Path(path) => <span class="prelude-val">Err</span>(syn::Error::new(
|
||||||
|
path.span(),
|
||||||
|
<span class="macro">format!</span>(
|
||||||
|
<span class="string">"expected `{path} = \"where_predicates\"`, `{path}(where_predicates)`, `{path} = \
|
||||||
|
false`, or `{path}(false)`"</span>,
|
||||||
|
path = path.clone().into_token_stream()
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>create_where_predicates_from_generic_parameters(
|
||||||
|
params: <span class="kw-2">&</span>Punctuated<GenericParam, Comma>,
|
||||||
|
bound_trait: <span class="kw-2">&</span>Path,
|
||||||
|
) -> WherePredicates {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>where_predicates = Punctuated::new();
|
||||||
|
|
||||||
|
<span class="kw">for </span>param <span class="kw">in </span>params {
|
||||||
|
<span class="kw">if let </span>GenericParam::Type(ty) = param {
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ty.ident;
|
||||||
|
|
||||||
|
where_predicates.push(syn::parse2(<span class="macro">quote! </span>{ #ident: #bound_trait }).unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
where_predicates
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>create_where_predicates_from_generic_parameters_check_types(
|
||||||
|
params: <span class="kw-2">&</span>Punctuated<GenericParam, Comma>,
|
||||||
|
bound_trait: <span class="kw-2">&</span>Path,
|
||||||
|
types: <span class="kw-2">&</span>[<span class="kw-2">&</span>Type],
|
||||||
|
recursive: <span class="prelude-ty">Option</span><(bool, bool, bool)>,
|
||||||
|
) -> WherePredicates {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>where_predicates = Punctuated::new();
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>set = HashSet::new();
|
||||||
|
|
||||||
|
<span class="kw">for </span>t <span class="kw">in </span>types {
|
||||||
|
find_idents_in_type(<span class="kw-2">&mut </span>set, t, recursive);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">for </span>param <span class="kw">in </span>params {
|
||||||
|
<span class="kw">if let </span>GenericParam::Type(ty) = param {
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ty.ident;
|
||||||
|
|
||||||
|
<span class="kw">if </span>set.contains(ident) {
|
||||||
|
where_predicates.push(syn::parse2(<span class="macro">quote! </span>{ #ident: #bound_trait }).unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
where_predicates
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
4040
src/educe/lib.rs.html
Normal file
4040
src/educe/lib.rs.html
Normal file
File diff suppressed because it is too large
Load diff
262
src/educe/panic.rs.html
Normal file
262
src/educe/panic.rs.html
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/panic.rs`."><title>panic.rs - source</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="educe" 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="../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>core::fmt::{<span class="self">self</span>, Display, Formatter};
|
||||||
|
|
||||||
|
<span class="kw">use </span>proc_macro2::Span;
|
||||||
|
<span class="kw">use </span>syn::{spanned::Spanned, Ident, Path, Variant};
|
||||||
|
|
||||||
|
<span class="kw">use crate</span>::{common::path::path_to_string, Trait};
|
||||||
|
|
||||||
|
<span class="kw">struct </span>DisplayStringSlice<<span class="lifetime">'a</span>>(<span class="kw-2">&</span><span class="lifetime">'a </span>[<span class="kw-2">&</span><span class="lifetime">'static </span>str]);
|
||||||
|
|
||||||
|
<span class="kw">impl</span><<span class="lifetime">'a</span>> Display <span class="kw">for </span>DisplayStringSlice<<span class="lifetime">'a</span>> {
|
||||||
|
<span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>Formatter<<span class="lifetime">'_</span>>) -> fmt::Result {
|
||||||
|
<span class="kw">if </span>!<span class="self">self</span>.<span class="number">0</span>.is_empty() {
|
||||||
|
f.write_str(<span class="string">", which should be reformatted as follows:"</span>)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span><span class="kw-2">&</span>s <span class="kw">in </span><span class="self">self</span>.<span class="number">0 </span>{
|
||||||
|
f.write_str(<span class="string">"\n "</span>)<span class="question-mark">?</span>;
|
||||||
|
f.write_str(s)<span class="question-mark">?</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">struct </span>DisplayTraits;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Display <span class="kw">for </span>DisplayTraits {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>Formatter<<span class="lifetime">'_</span>>) -> fmt::Result {
|
||||||
|
<span class="kw">for </span>t <span class="kw">in </span><span class="kw-2">&</span>Trait::VARIANTS[..Trait::VARIANTS.len() - <span class="number">1</span>] {
|
||||||
|
f.write_str(<span class="string">"\n "</span>)<span class="question-mark">?</span>;
|
||||||
|
f.write_fmt(<span class="macro">format_args!</span>(<span class="string">"{t:?}"</span>))<span class="question-mark">?</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>derive_attribute_not_set_up_yet() -> syn::Error {
|
||||||
|
syn::Error::new(
|
||||||
|
Span::call_site(),
|
||||||
|
<span class="string">"you are using `Educe` in the `derive` attribute, but it has not been set up yet"</span>,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>attribute_incorrect_place(name: <span class="kw-2">&</span>Ident) -> syn::Error {
|
||||||
|
syn::Error::new(name.span(), <span class="macro">format!</span>(<span class="string">"the `{name}` attribute cannot be placed here"</span>))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>attribute_incorrect_format_with_span(
|
||||||
|
name: <span class="kw-2">&</span>Ident,
|
||||||
|
span: Span,
|
||||||
|
correct_usage: <span class="kw-2">&</span>[<span class="kw-2">&</span><span class="lifetime">'static </span>str],
|
||||||
|
) -> syn::Error {
|
||||||
|
<span class="kw">if </span>correct_usage.is_empty() {
|
||||||
|
attribute_incorrect_place(name)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
syn::Error::new(
|
||||||
|
span,
|
||||||
|
<span class="macro">format!</span>(
|
||||||
|
<span class="string">"you are using an incorrect format of the `{name}` attribute{}"</span>,
|
||||||
|
DisplayStringSlice(correct_usage)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>attribute_incorrect_format(
|
||||||
|
name: <span class="kw-2">&</span>Ident,
|
||||||
|
correct_usage: <span class="kw-2">&</span>[<span class="kw-2">&</span><span class="lifetime">'static </span>str],
|
||||||
|
) -> syn::Error {
|
||||||
|
attribute_incorrect_format_with_span(name, name.span(), correct_usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>parameter_reset(name: <span class="kw-2">&</span>Ident) -> syn::Error {
|
||||||
|
syn::Error::new(name.span(), <span class="macro">format!</span>(<span class="string">"you are trying to reset the `{name}` parameter"</span>))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>educe_format_incorrect(name: <span class="kw-2">&</span>Ident) -> syn::Error {
|
||||||
|
attribute_incorrect_format(name, <span class="kw-2">&</span>[<span class="macro">stringify!</span>(<span class="attr">#[educe(Trait1, Trait2, ..., TraitN)]</span>)])
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>unsupported_trait(name: <span class="kw-2">&</span>Path) -> syn::Error {
|
||||||
|
<span class="kw">let </span>span = name.span();
|
||||||
|
|
||||||
|
<span class="kw">match </span>name.get_ident() {
|
||||||
|
<span class="prelude-val">Some</span>(name) => syn::Error::new(
|
||||||
|
span,
|
||||||
|
<span class="macro">format!</span>(<span class="string">"unsupported trait `{name}`, available traits:{DisplayTraits}"</span>),
|
||||||
|
),
|
||||||
|
<span class="prelude-val">None </span>=> {
|
||||||
|
<span class="kw">let </span>name = path_to_string(name);
|
||||||
|
|
||||||
|
syn::Error::new(
|
||||||
|
span,
|
||||||
|
<span class="macro">format!</span>(<span class="string">"unsupported trait `{name}`, available traits:{DisplayTraits}"</span>),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>reuse_a_trait(name: <span class="kw-2">&</span>Ident) -> syn::Error {
|
||||||
|
syn::Error::new(name.span(), <span class="macro">format!</span>(<span class="string">"the trait `{name}` is used repeatedly"</span>))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>trait_not_used(name: <span class="kw-2">&</span>Ident) -> syn::Error {
|
||||||
|
syn::Error::new(name.span(), <span class="macro">format!</span>(<span class="string">"the trait `{name}` is not used"</span>))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>trait_not_support_union(name: <span class="kw-2">&</span>Ident) -> syn::Error {
|
||||||
|
syn::Error::new(name.span(), <span class="macro">format!</span>(<span class="string">"the trait `{name}` does not support to a union"</span>))
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>trait_not_support_unit_variant(name: <span class="kw-2">&</span>Ident, variant: <span class="kw-2">&</span>Variant) -> syn::Error {
|
||||||
|
syn::Error::new(
|
||||||
|
variant.span(),
|
||||||
|
<span class="macro">format!</span>(<span class="string">"the trait `{name}` cannot be implemented for an enum which has unit variants"</span>),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
178
src/educe/supported_traits.rs.html
Normal file
178
src/educe/supported_traits.rs.html
Normal file
|
@ -0,0 +1,178 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/supported_traits.rs`."><title>supported_traits.rs - source</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="educe" 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="../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="attr">#[cfg(not(any(
|
||||||
|
feature = <span class="string">"Debug"</span>,
|
||||||
|
feature = <span class="string">"Clone"</span>,
|
||||||
|
feature = <span class="string">"Copy"</span>,
|
||||||
|
feature = <span class="string">"PartialEq"</span>,
|
||||||
|
feature = <span class="string">"Eq"</span>,
|
||||||
|
feature = <span class="string">"PartialOrd"</span>,
|
||||||
|
feature = <span class="string">"Ord"</span>,
|
||||||
|
feature = <span class="string">"Hash"</span>,
|
||||||
|
feature = <span class="string">"Default"</span>,
|
||||||
|
feature = <span class="string">"Deref"</span>,
|
||||||
|
feature = <span class="string">"DerefMut"</span>,
|
||||||
|
feature = <span class="string">"Into"</span>,
|
||||||
|
)))]
|
||||||
|
</span><span class="macro">compile_error!</span>(<span class="string">"at least one of the trait features must be enabled"</span>);
|
||||||
|
|
||||||
|
<span class="kw">use </span>enum_ordinalize::Ordinalize;
|
||||||
|
<span class="kw">use </span>syn::Path;
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Ordinalize)]
|
||||||
|
#[ordinalize(impl_trait = <span class="bool-val">false</span>)]
|
||||||
|
#[ordinalize(variants(<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">const </span>VARIANTS))]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">enum </span>Trait {
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Debug"</span>)]
|
||||||
|
</span>Debug,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Clone"</span>)]
|
||||||
|
</span>Clone,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Copy"</span>)]
|
||||||
|
</span>Copy,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"PartialEq"</span>)]
|
||||||
|
</span>PartialEq,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Eq"</span>)]
|
||||||
|
</span>Eq,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"PartialOrd"</span>)]
|
||||||
|
</span>PartialOrd,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Ord"</span>)]
|
||||||
|
</span>Ord,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Hash"</span>)]
|
||||||
|
</span>Hash,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Default"</span>)]
|
||||||
|
</span>Default,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Deref"</span>)]
|
||||||
|
</span>Deref,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"DerefMut"</span>)]
|
||||||
|
</span>DerefMut,
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Into"</span>)]
|
||||||
|
</span>Into,
|
||||||
|
|
||||||
|
_Nothing,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>Trait {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>from_path(path: <span class="kw-2">&</span>Path) -> <span class="prelude-ty">Option</span><<span class="self">Self</span>> {
|
||||||
|
<span class="kw">let </span>ident_string = <span class="kw">match </span>path.get_ident() {
|
||||||
|
<span class="prelude-val">Some</span>(ident) => ident.to_string(),
|
||||||
|
<span class="prelude-val">None </span>=> <span class="kw">return </span><span class="prelude-val">None</span>,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">match </span>ident_string.as_str() {
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Debug"</span>)]
|
||||||
|
</span><span class="string">"Debug" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::Debug),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Clone"</span>)]
|
||||||
|
</span><span class="string">"Clone" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::Clone),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Copy"</span>)]
|
||||||
|
</span><span class="string">"Copy" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::Copy),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"PartialEq"</span>)]
|
||||||
|
</span><span class="string">"PartialEq" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::PartialEq),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Eq"</span>)]
|
||||||
|
</span><span class="string">"Eq" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::Eq),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"PartialOrd"</span>)]
|
||||||
|
</span><span class="string">"PartialOrd" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::PartialOrd),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Ord"</span>)]
|
||||||
|
</span><span class="string">"Ord" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::Ord),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Hash"</span>)]
|
||||||
|
</span><span class="string">"Hash" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::Hash),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Default"</span>)]
|
||||||
|
</span><span class="string">"Default" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::Default),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Deref"</span>)]
|
||||||
|
</span><span class="string">"Deref" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::Deref),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"DerefMut"</span>)]
|
||||||
|
</span><span class="string">"DerefMut" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::DerefMut),
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Into"</span>)]
|
||||||
|
</span><span class="string">"Into" </span>=> <span class="prelude-val">Some</span>(<span class="self">Self</span>::Into),
|
||||||
|
<span class="kw">_ </span>=> <span class="prelude-val">None</span>,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
544
src/educe/trait_handlers/clone/clone_enum.rs.html
Normal file
544
src/educe/trait_handlers/clone/clone_enum.rs.html
Normal file
|
@ -0,0 +1,544 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/clone/clone_enum.rs`."><title>clone_enum.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
<a href="#136" id="136">136</a>
|
||||||
|
<a href="#137" id="137">137</a>
|
||||||
|
<a href="#138" id="138">138</a>
|
||||||
|
<a href="#139" id="139">139</a>
|
||||||
|
<a href="#140" id="140">140</a>
|
||||||
|
<a href="#141" id="141">141</a>
|
||||||
|
<a href="#142" id="142">142</a>
|
||||||
|
<a href="#143" id="143">143</a>
|
||||||
|
<a href="#144" id="144">144</a>
|
||||||
|
<a href="#145" id="145">145</a>
|
||||||
|
<a href="#146" id="146">146</a>
|
||||||
|
<a href="#147" id="147">147</a>
|
||||||
|
<a href="#148" id="148">148</a>
|
||||||
|
<a href="#149" id="149">149</a>
|
||||||
|
<a href="#150" id="150">150</a>
|
||||||
|
<a href="#151" id="151">151</a>
|
||||||
|
<a href="#152" id="152">152</a>
|
||||||
|
<a href="#153" id="153">153</a>
|
||||||
|
<a href="#154" id="154">154</a>
|
||||||
|
<a href="#155" id="155">155</a>
|
||||||
|
<a href="#156" id="156">156</a>
|
||||||
|
<a href="#157" id="157">157</a>
|
||||||
|
<a href="#158" id="158">158</a>
|
||||||
|
<a href="#159" id="159">159</a>
|
||||||
|
<a href="#160" id="160">160</a>
|
||||||
|
<a href="#161" id="161">161</a>
|
||||||
|
<a href="#162" id="162">162</a>
|
||||||
|
<a href="#163" id="163">163</a>
|
||||||
|
<a href="#164" id="164">164</a>
|
||||||
|
<a href="#165" id="165">165</a>
|
||||||
|
<a href="#166" id="166">166</a>
|
||||||
|
<a href="#167" id="167">167</a>
|
||||||
|
<a href="#168" id="168">168</a>
|
||||||
|
<a href="#169" id="169">169</a>
|
||||||
|
<a href="#170" id="170">170</a>
|
||||||
|
<a href="#171" id="171">171</a>
|
||||||
|
<a href="#172" id="172">172</a>
|
||||||
|
<a href="#173" id="173">173</a>
|
||||||
|
<a href="#174" id="174">174</a>
|
||||||
|
<a href="#175" id="175">175</a>
|
||||||
|
<a href="#176" id="176">176</a>
|
||||||
|
<a href="#177" id="177">177</a>
|
||||||
|
<a href="#178" id="178">178</a>
|
||||||
|
<a href="#179" id="179">179</a>
|
||||||
|
<a href="#180" id="180">180</a>
|
||||||
|
<a href="#181" id="181">181</a>
|
||||||
|
<a href="#182" id="182">182</a>
|
||||||
|
<a href="#183" id="183">183</a>
|
||||||
|
<a href="#184" id="184">184</a>
|
||||||
|
<a href="#185" id="185">185</a>
|
||||||
|
<a href="#186" id="186">186</a>
|
||||||
|
<a href="#187" id="187">187</a>
|
||||||
|
<a href="#188" id="188">188</a>
|
||||||
|
<a href="#189" id="189">189</a>
|
||||||
|
<a href="#190" id="190">190</a>
|
||||||
|
<a href="#191" id="191">191</a>
|
||||||
|
<a href="#192" id="192">192</a>
|
||||||
|
<a href="#193" id="193">193</a>
|
||||||
|
<a href="#194" id="194">194</a>
|
||||||
|
<a href="#195" id="195">195</a>
|
||||||
|
<a href="#196" id="196">196</a>
|
||||||
|
<a href="#197" id="197">197</a>
|
||||||
|
<a href="#198" id="198">198</a>
|
||||||
|
<a href="#199" id="199">199</a>
|
||||||
|
<a href="#200" id="200">200</a>
|
||||||
|
<a href="#201" id="201">201</a>
|
||||||
|
<a href="#202" id="202">202</a>
|
||||||
|
<a href="#203" id="203">203</a>
|
||||||
|
<a href="#204" id="204">204</a>
|
||||||
|
<a href="#205" id="205">205</a>
|
||||||
|
<a href="#206" id="206">206</a>
|
||||||
|
<a href="#207" id="207">207</a>
|
||||||
|
<a href="#208" id="208">208</a>
|
||||||
|
<a href="#209" id="209">209</a>
|
||||||
|
<a href="#210" id="210">210</a>
|
||||||
|
<a href="#211" id="211">211</a>
|
||||||
|
<a href="#212" id="212">212</a>
|
||||||
|
<a href="#213" id="213">213</a>
|
||||||
|
<a href="#214" id="214">214</a>
|
||||||
|
<a href="#215" id="215">215</a>
|
||||||
|
<a href="#216" id="216">216</a>
|
||||||
|
<a href="#217" id="217">217</a>
|
||||||
|
<a href="#218" id="218">218</a>
|
||||||
|
<a href="#219" id="219">219</a>
|
||||||
|
<a href="#220" id="220">220</a>
|
||||||
|
<a href="#221" id="221">221</a>
|
||||||
|
<a href="#222" id="222">222</a>
|
||||||
|
<a href="#223" id="223">223</a>
|
||||||
|
<a href="#224" id="224">224</a>
|
||||||
|
<a href="#225" id="225">225</a>
|
||||||
|
<a href="#226" id="226">226</a>
|
||||||
|
<a href="#227" id="227">227</a>
|
||||||
|
<a href="#228" id="228">228</a>
|
||||||
|
<a href="#229" id="229">229</a>
|
||||||
|
<a href="#230" id="230">230</a>
|
||||||
|
<a href="#231" id="231">231</a>
|
||||||
|
<a href="#232" id="232">232</a>
|
||||||
|
<a href="#233" id="233">233</a>
|
||||||
|
<a href="#234" id="234">234</a>
|
||||||
|
<a href="#235" id="235">235</a>
|
||||||
|
<a href="#236" id="236">236</a>
|
||||||
|
<a href="#237" id="237">237</a>
|
||||||
|
<a href="#238" id="238">238</a>
|
||||||
|
<a href="#239" id="239">239</a>
|
||||||
|
<a href="#240" id="240">240</a>
|
||||||
|
<a href="#241" id="241">241</a>
|
||||||
|
<a href="#242" id="242">242</a>
|
||||||
|
<a href="#243" id="243">243</a>
|
||||||
|
<a href="#244" id="244">244</a>
|
||||||
|
<a href="#245" id="245">245</a>
|
||||||
|
<a href="#246" id="246">246</a>
|
||||||
|
<a href="#247" id="247">247</a>
|
||||||
|
<a href="#248" id="248">248</a>
|
||||||
|
<a href="#249" id="249">249</a>
|
||||||
|
<a href="#250" id="250">250</a>
|
||||||
|
<a href="#251" id="251">251</a>
|
||||||
|
<a href="#252" id="252">252</a>
|
||||||
|
<a href="#253" id="253">253</a>
|
||||||
|
<a href="#254" id="254">254</a>
|
||||||
|
<a href="#255" id="255">255</a>
|
||||||
|
<a href="#256" id="256">256</a>
|
||||||
|
<a href="#257" id="257">257</a>
|
||||||
|
<a href="#258" id="258">258</a>
|
||||||
|
<a href="#259" id="259">259</a>
|
||||||
|
<a href="#260" id="260">260</a>
|
||||||
|
<a href="#261" id="261">261</a>
|
||||||
|
<a href="#262" id="262">262</a>
|
||||||
|
<a href="#263" id="263">263</a>
|
||||||
|
<a href="#264" id="264">264</a>
|
||||||
|
<a href="#265" id="265">265</a>
|
||||||
|
<a href="#266" id="266">266</a>
|
||||||
|
<a href="#267" id="267">267</a>
|
||||||
|
<a href="#268" id="268">268</a>
|
||||||
|
<a href="#269" id="269">269</a>
|
||||||
|
<a href="#270" id="270">270</a>
|
||||||
|
<a href="#271" id="271">271</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::{format_ident, quote};
|
||||||
|
<span class="kw">use </span>syn::{punctuated::Punctuated, Data, DeriveInput, Field, Fields, Meta, Type, Variant};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">super</span>::models::{FieldAttribute, FieldAttributeBuilder, TypeAttributeBuilder};
|
||||||
|
<span class="kw">use crate</span>::{
|
||||||
|
common::where_predicates_bool::WherePredicates, supported_traits::Trait, TraitHandler,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>CloneEnumHandler;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TraitHandler <span class="kw">for </span>CloneEnumHandler {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>trait_meta_handler(
|
||||||
|
ast: <span class="kw-2">&mut </span>DeriveInput,
|
||||||
|
token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream,
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
meta: <span class="kw-2">&</span>Meta,
|
||||||
|
) -> syn::Result<()> {
|
||||||
|
<span class="kw">let </span>type_attribute = TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">true</span>, enable_bound: <span class="bool-val">true
|
||||||
|
</span>}
|
||||||
|
.build_from_clone_meta(meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>bound: WherePredicates = Punctuated::new();
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_from_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">if let </span>Data::Enum(data) = <span class="kw-2">&</span>ast.data {
|
||||||
|
<span class="kw">type </span>Variants<<span class="lifetime">'a</span>> = Vec<(<span class="kw-2">&</span><span class="lifetime">'a </span>Variant, Vec<(<span class="kw-2">&</span><span class="lifetime">'a </span>Field, FieldAttribute)>)>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>variants: Variants = Vec::new();
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Copy"</span>)]
|
||||||
|
</span><span class="kw">let </span><span class="kw-2">mut </span>has_custom_clone_method = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>variant <span class="kw">in </span>data.variants.iter() {
|
||||||
|
<span class="kw">let _ </span>= TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">false</span>, enable_bound: <span class="bool-val">false
|
||||||
|
</span>}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>variant.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>variant_fields: Vec<(<span class="kw-2">&</span>Field, FieldAttribute)> = Vec::new();
|
||||||
|
|
||||||
|
<span class="kw">for </span>field <span class="kw">in </span>variant.fields.iter() {
|
||||||
|
<span class="kw">let </span>field_attribute = FieldAttributeBuilder {
|
||||||
|
enable_method: <span class="bool-val">true
|
||||||
|
</span>}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Copy"</span>)]
|
||||||
|
</span><span class="kw">if </span>field_attribute.method.is_some() {
|
||||||
|
has_custom_clone_method = <span class="bool-val">true</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
variant_fields.push((field, field_attribute));
|
||||||
|
}
|
||||||
|
|
||||||
|
variants.push((variant, variant_fields));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Copy"</span>)]
|
||||||
|
</span><span class="kw">let </span>contains_copy = !has_custom_clone_method && traits.contains(<span class="kw-2">&</span>Trait::Copy);
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(not(feature = <span class="string">"Copy"</span>))]
|
||||||
|
</span><span class="kw">let </span>contains_copy = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>contains_copy {
|
||||||
|
clone_token_stream.extend(<span class="macro">quote!</span>(<span class="kw-2">*</span><span class="self">self</span>));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_types: Vec<<span class="kw-2">&</span>Type> = Vec::new();
|
||||||
|
|
||||||
|
<span class="kw">if </span>variants.is_empty() {
|
||||||
|
<span class="kw">if </span>!contains_copy {
|
||||||
|
clone_token_stream.extend(<span class="macro">quote!</span>(<span class="macro">unreachable!</span>()));
|
||||||
|
clone_from_token_stream.extend(<span class="macro">quote!</span>(<span class="kw">let _ </span>= source;));
|
||||||
|
}
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_variants_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_from_variants_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">for </span>(variant, variant_fields) <span class="kw">in </span>variants {
|
||||||
|
<span class="kw">let </span>variant_ident = <span class="kw-2">&</span>variant.ident;
|
||||||
|
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>variant.fields {
|
||||||
|
Fields::Unit => {
|
||||||
|
clone_variants_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="self">Self</span>::#variant_ident => <span class="self">Self</span>::#variant_ident,
|
||||||
|
});
|
||||||
|
clone_from_variants_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="self">Self</span>::#variant_ident => {
|
||||||
|
<span class="kw">if let </span><span class="self">Self</span>::#variant_ident = source {
|
||||||
|
<span class="comment">// same
|
||||||
|
</span>} <span class="kw">else </span>{
|
||||||
|
<span class="kw-2">*</span><span class="self">self </span>= ::core::clone::Clone::clone(source);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
Fields::Named(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>pattern_src_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>pattern_dst_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>cl_fields_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>cf_body_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">for </span>(field, field_attribute) <span class="kw">in </span>variant_fields {
|
||||||
|
<span class="kw">let </span>field_name_real = field.ident.as_ref().unwrap();
|
||||||
|
<span class="kw">let </span>field_name_src = <span class="macro">format_ident!</span>(<span class="string">"_s_{}"</span>, field_name_real);
|
||||||
|
<span class="kw">let </span>field_name_dst = <span class="macro">format_ident!</span>(<span class="string">"_d_{}"</span>, field_name_real);
|
||||||
|
|
||||||
|
pattern_src_token_stream
|
||||||
|
.extend(<span class="macro">quote!</span>(#field_name_real: #field_name_src,));
|
||||||
|
pattern_dst_token_stream
|
||||||
|
.extend(<span class="macro">quote!</span>(#field_name_real: #field_name_dst,));
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(clone) = field_attribute.method.as_ref() {
|
||||||
|
cl_fields_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
#field_name_real: #clone(#field_name_src),
|
||||||
|
});
|
||||||
|
cf_body_token_stream.extend(
|
||||||
|
<span class="macro">quote!</span>(<span class="kw-2">*</span>#field_name_dst = #clone(#field_name_src);),
|
||||||
|
);
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
clone_types.push(<span class="kw-2">&</span>field.ty);
|
||||||
|
|
||||||
|
cl_fields_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
#field_name_real: ::core::clone::Clone::clone(#field_name_src),
|
||||||
|
});
|
||||||
|
cf_body_token_stream.extend(
|
||||||
|
<span class="macro">quote!</span>( ::core::clone::Clone::clone_from(#field_name_dst, #field_name_src); ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clone_variants_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="self">Self</span>::#variant_ident { #pattern_src_token_stream } => <span class="self">Self</span>::#variant_ident { #cl_fields_token_stream },
|
||||||
|
});
|
||||||
|
|
||||||
|
clone_from_variants_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="self">Self</span>::#variant_ident { #pattern_dst_token_stream } => {
|
||||||
|
<span class="kw">if let </span><span class="self">Self</span>::#variant_ident { #pattern_src_token_stream } = source {
|
||||||
|
#cf_body_token_stream
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw-2">*</span><span class="self">self </span>= ::core::clone::Clone::clone(source);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
Fields::Unnamed(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>pattern_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>pattern2_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>fields_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>body_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">for </span>(index, (field, field_attribute)) <span class="kw">in
|
||||||
|
</span>variant_fields.into_iter().enumerate()
|
||||||
|
{
|
||||||
|
<span class="kw">let </span>field_name_src = <span class="macro">format_ident!</span>(<span class="string">"_{}"</span>, index);
|
||||||
|
|
||||||
|
pattern_token_stream.extend(<span class="macro">quote!</span>(#field_name_src,));
|
||||||
|
|
||||||
|
<span class="kw">let </span>field_name_dst = <span class="macro">format_ident!</span>(<span class="string">"_{}"</span>, field_name_src);
|
||||||
|
|
||||||
|
pattern2_token_stream.extend(<span class="macro">quote!</span>(#field_name_dst,));
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(clone) = field_attribute.method.as_ref() {
|
||||||
|
fields_token_stream.extend(<span class="macro">quote! </span>(#clone(#field_name_src),));
|
||||||
|
body_token_stream.extend(
|
||||||
|
<span class="macro">quote!</span>(<span class="kw-2">*</span>#field_name_src = #clone(#field_name_dst);),
|
||||||
|
);
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
clone_types.push(<span class="kw-2">&</span>field.ty);
|
||||||
|
|
||||||
|
fields_token_stream.extend(
|
||||||
|
<span class="macro">quote! </span>( ::core::clone::Clone::clone(#field_name_src), ),
|
||||||
|
);
|
||||||
|
body_token_stream.extend(
|
||||||
|
<span class="macro">quote!</span>( ::core::clone::Clone::clone_from(#field_name_src, #field_name_dst); ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clone_variants_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="self">Self</span>::#variant_ident ( #pattern_token_stream ) => <span class="self">Self</span>::#variant_ident ( #fields_token_stream ),
|
||||||
|
});
|
||||||
|
|
||||||
|
clone_from_variants_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="self">Self</span>::#variant_ident ( #pattern_token_stream ) => {
|
||||||
|
<span class="kw">if let </span><span class="self">Self</span>::#variant_ident ( #pattern2_token_stream ) = source {
|
||||||
|
#body_token_stream
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw-2">*</span><span class="self">self </span>= ::core::clone::Clone::clone(source);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>!contains_copy {
|
||||||
|
clone_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">match </span><span class="self">self </span>{
|
||||||
|
#clone_variants_token_stream
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
clone_from_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">match </span><span class="self">self </span>{
|
||||||
|
#clone_from_variants_token_stream
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bound = type_attribute.bound.into_where_predicates_by_generic_parameters_check_types(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
<span class="kw-2">&</span>syn::parse2(<span class="kw">if </span>contains_copy {
|
||||||
|
<span class="macro">quote!</span>(::core::marker::Copy)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="macro">quote!</span>(::core::clone::Clone)
|
||||||
|
})
|
||||||
|
.unwrap(),
|
||||||
|
<span class="kw-2">&</span>clone_types,
|
||||||
|
<span class="prelude-val">Some</span>((<span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>clone_from_fn_token_stream = <span class="kw">if </span>clone_from_token_stream.is_empty() {
|
||||||
|
<span class="prelude-val">None
|
||||||
|
</span>} <span class="kw">else </span>{
|
||||||
|
<span class="prelude-val">Some</span>(<span class="macro">quote! </span>{
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>clone_from(<span class="kw-2">&mut </span><span class="self">self</span>, source: <span class="kw-2">&</span><span class="self">Self</span>) {
|
||||||
|
#clone_from_token_stream
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ast.ident;
|
||||||
|
|
||||||
|
<span class="kw">let </span>where_clause = ast.generics.make_where_clause();
|
||||||
|
|
||||||
|
<span class="kw">for </span>where_predicate <span class="kw">in </span>bound {
|
||||||
|
where_clause.predicates.push(where_predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>(impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
||||||
|
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::clone::Clone <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>clone(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="self">Self </span>{
|
||||||
|
#clone_token_stream
|
||||||
|
}
|
||||||
|
|
||||||
|
#clone_from_fn_token_stream
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Copy"</span>)]
|
||||||
|
</span><span class="kw">if </span>traits.contains(<span class="kw-2">&</span>Trait::Copy) {
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::marker::Copy <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
390
src/educe/trait_handlers/clone/clone_struct.rs.html
Normal file
390
src/educe/trait_handlers/clone/clone_struct.rs.html
Normal file
|
@ -0,0 +1,390 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/clone/clone_struct.rs`."><title>clone_struct.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
<a href="#136" id="136">136</a>
|
||||||
|
<a href="#137" id="137">137</a>
|
||||||
|
<a href="#138" id="138">138</a>
|
||||||
|
<a href="#139" id="139">139</a>
|
||||||
|
<a href="#140" id="140">140</a>
|
||||||
|
<a href="#141" id="141">141</a>
|
||||||
|
<a href="#142" id="142">142</a>
|
||||||
|
<a href="#143" id="143">143</a>
|
||||||
|
<a href="#144" id="144">144</a>
|
||||||
|
<a href="#145" id="145">145</a>
|
||||||
|
<a href="#146" id="146">146</a>
|
||||||
|
<a href="#147" id="147">147</a>
|
||||||
|
<a href="#148" id="148">148</a>
|
||||||
|
<a href="#149" id="149">149</a>
|
||||||
|
<a href="#150" id="150">150</a>
|
||||||
|
<a href="#151" id="151">151</a>
|
||||||
|
<a href="#152" id="152">152</a>
|
||||||
|
<a href="#153" id="153">153</a>
|
||||||
|
<a href="#154" id="154">154</a>
|
||||||
|
<a href="#155" id="155">155</a>
|
||||||
|
<a href="#156" id="156">156</a>
|
||||||
|
<a href="#157" id="157">157</a>
|
||||||
|
<a href="#158" id="158">158</a>
|
||||||
|
<a href="#159" id="159">159</a>
|
||||||
|
<a href="#160" id="160">160</a>
|
||||||
|
<a href="#161" id="161">161</a>
|
||||||
|
<a href="#162" id="162">162</a>
|
||||||
|
<a href="#163" id="163">163</a>
|
||||||
|
<a href="#164" id="164">164</a>
|
||||||
|
<a href="#165" id="165">165</a>
|
||||||
|
<a href="#166" id="166">166</a>
|
||||||
|
<a href="#167" id="167">167</a>
|
||||||
|
<a href="#168" id="168">168</a>
|
||||||
|
<a href="#169" id="169">169</a>
|
||||||
|
<a href="#170" id="170">170</a>
|
||||||
|
<a href="#171" id="171">171</a>
|
||||||
|
<a href="#172" id="172">172</a>
|
||||||
|
<a href="#173" id="173">173</a>
|
||||||
|
<a href="#174" id="174">174</a>
|
||||||
|
<a href="#175" id="175">175</a>
|
||||||
|
<a href="#176" id="176">176</a>
|
||||||
|
<a href="#177" id="177">177</a>
|
||||||
|
<a href="#178" id="178">178</a>
|
||||||
|
<a href="#179" id="179">179</a>
|
||||||
|
<a href="#180" id="180">180</a>
|
||||||
|
<a href="#181" id="181">181</a>
|
||||||
|
<a href="#182" id="182">182</a>
|
||||||
|
<a href="#183" id="183">183</a>
|
||||||
|
<a href="#184" id="184">184</a>
|
||||||
|
<a href="#185" id="185">185</a>
|
||||||
|
<a href="#186" id="186">186</a>
|
||||||
|
<a href="#187" id="187">187</a>
|
||||||
|
<a href="#188" id="188">188</a>
|
||||||
|
<a href="#189" id="189">189</a>
|
||||||
|
<a href="#190" id="190">190</a>
|
||||||
|
<a href="#191" id="191">191</a>
|
||||||
|
<a href="#192" id="192">192</a>
|
||||||
|
<a href="#193" id="193">193</a>
|
||||||
|
<a href="#194" id="194">194</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::quote;
|
||||||
|
<span class="kw">use </span>syn::{punctuated::Punctuated, Data, DeriveInput, Field, Fields, Index, Meta, Type};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">super</span>::models::{FieldAttribute, FieldAttributeBuilder, TypeAttributeBuilder};
|
||||||
|
<span class="kw">use crate</span>::{
|
||||||
|
common::where_predicates_bool::WherePredicates, supported_traits::Trait, TraitHandler,
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>CloneStructHandler;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TraitHandler <span class="kw">for </span>CloneStructHandler {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>trait_meta_handler(
|
||||||
|
ast: <span class="kw-2">&mut </span>DeriveInput,
|
||||||
|
token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream,
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
meta: <span class="kw-2">&</span>Meta,
|
||||||
|
) -> syn::Result<()> {
|
||||||
|
<span class="kw">let </span>type_attribute = TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">true</span>, enable_bound: <span class="bool-val">true
|
||||||
|
</span>}
|
||||||
|
.build_from_clone_meta(meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>bound: WherePredicates = Punctuated::new();
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_from_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">if let </span>Data::Struct(data) = <span class="kw-2">&</span>ast.data {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>fields: Vec<(<span class="kw-2">&</span>Field, FieldAttribute)> = Vec::new();
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Copy"</span>)]
|
||||||
|
</span><span class="kw">let </span>contains_copy = traits.contains(<span class="kw-2">&</span>Trait::Copy);
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(not(feature = <span class="string">"Copy"</span>))]
|
||||||
|
</span><span class="kw">let </span>contains_copy = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>contains_copy {
|
||||||
|
clone_token_stream.extend(<span class="macro">quote!</span>(<span class="kw-2">*</span><span class="self">self</span>));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">for </span>field <span class="kw">in </span>data.fields.iter() {
|
||||||
|
<span class="kw">let </span>field_attribute = FieldAttributeBuilder {
|
||||||
|
enable_method: !contains_copy
|
||||||
|
}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
fields.push((field, field_attribute));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_types: Vec<<span class="kw-2">&</span>Type> = Vec::new();
|
||||||
|
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>data.fields {
|
||||||
|
Fields::Unit => {
|
||||||
|
<span class="kw">if </span>!contains_copy {
|
||||||
|
clone_token_stream.extend(<span class="macro">quote!</span>(<span class="self">Self</span>));
|
||||||
|
clone_from_token_stream.extend(<span class="macro">quote!</span>(<span class="kw">let _ </span>= source;));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Fields::Named(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>fields_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_from_body_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">if </span>fields.is_empty() {
|
||||||
|
clone_from_body_token_stream.extend(<span class="macro">quote!</span>(<span class="kw">let _ </span>= source;));
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">for </span>(field, field_attribute) <span class="kw">in </span>fields {
|
||||||
|
<span class="kw">let </span>field_name = field.ident.as_ref().unwrap();
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(clone) = field_attribute.method.as_ref() {
|
||||||
|
fields_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
#field_name: #clone(<span class="kw-2">&</span><span class="self">self</span>.#field_name),
|
||||||
|
});
|
||||||
|
|
||||||
|
clone_from_body_token_stream.extend(
|
||||||
|
<span class="macro">quote!</span>(<span class="self">self</span>.#field_name = #clone(<span class="kw-2">&</span>source.#field_name);),
|
||||||
|
);
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
clone_types.push(<span class="kw-2">&</span>field.ty);
|
||||||
|
|
||||||
|
fields_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
#field_name: ::core::clone::Clone::clone(<span class="kw-2">&</span><span class="self">self</span>.#field_name),
|
||||||
|
});
|
||||||
|
|
||||||
|
clone_from_body_token_stream.extend(
|
||||||
|
<span class="macro">quote!</span>( ::core::clone::Clone::clone_from(<span class="kw-2">&mut </span><span class="self">self</span>.#field_name, <span class="kw-2">&</span>source.#field_name); ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>!contains_copy {
|
||||||
|
clone_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="self">Self </span>{
|
||||||
|
#fields_token_stream
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
clone_from_token_stream.extend(clone_from_body_token_stream);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Fields::Unnamed(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>fields_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>clone_from_body_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">if </span>fields.is_empty() {
|
||||||
|
clone_from_body_token_stream.extend(<span class="macro">quote!</span>(<span class="kw">let _ </span>= source;));
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">for </span>(index, (field, field_attribute)) <span class="kw">in </span>fields.into_iter().enumerate() {
|
||||||
|
<span class="kw">let </span>field_name = Index::from(index);
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(clone) = field_attribute.method.as_ref() {
|
||||||
|
fields_token_stream.extend(<span class="macro">quote!</span>(#clone(<span class="kw-2">&</span><span class="self">self</span>.#field_name),));
|
||||||
|
|
||||||
|
clone_from_body_token_stream.extend(
|
||||||
|
<span class="macro">quote!</span>(<span class="self">self</span>.#field_name = #clone(<span class="kw-2">&</span>source.#field_name);),
|
||||||
|
);
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
clone_types.push(<span class="kw-2">&</span>field.ty);
|
||||||
|
|
||||||
|
fields_token_stream.extend(
|
||||||
|
<span class="macro">quote! </span>( ::core::clone::Clone::clone(<span class="kw-2">&</span><span class="self">self</span>.#field_name), ),
|
||||||
|
);
|
||||||
|
|
||||||
|
clone_from_body_token_stream.extend(
|
||||||
|
<span class="macro">quote!</span>( ::core::clone::Clone::clone_from(<span class="kw-2">&mut </span><span class="self">self</span>.#field_name, <span class="kw-2">&</span>source.#field_name); ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>!contains_copy {
|
||||||
|
clone_token_stream.extend(<span class="macro">quote!</span>(<span class="self">Self </span>( #fields_token_stream )));
|
||||||
|
clone_from_token_stream.extend(clone_from_body_token_stream);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
bound = type_attribute.bound.into_where_predicates_by_generic_parameters_check_types(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
<span class="kw-2">&</span>syn::parse2(<span class="kw">if </span>contains_copy {
|
||||||
|
<span class="macro">quote!</span>(::core::marker::Copy)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="macro">quote!</span>(::core::clone::Clone)
|
||||||
|
})
|
||||||
|
.unwrap(),
|
||||||
|
<span class="kw-2">&</span>clone_types,
|
||||||
|
<span class="prelude-val">Some</span>((<span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>clone_from_fn_token_stream = <span class="kw">if </span>clone_from_token_stream.is_empty() {
|
||||||
|
<span class="prelude-val">None
|
||||||
|
</span>} <span class="kw">else </span>{
|
||||||
|
<span class="prelude-val">Some</span>(<span class="macro">quote! </span>{
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>clone_from(<span class="kw-2">&mut </span><span class="self">self</span>, source: <span class="kw-2">&</span><span class="self">Self</span>) {
|
||||||
|
#clone_from_token_stream
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ast.ident;
|
||||||
|
|
||||||
|
<span class="kw">let </span>where_clause = ast.generics.make_where_clause();
|
||||||
|
|
||||||
|
<span class="kw">for </span>where_predicate <span class="kw">in </span>bound {
|
||||||
|
where_clause.predicates.push(where_predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>(impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
||||||
|
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::clone::Clone <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>clone(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="self">Self </span>{
|
||||||
|
#clone_token_stream
|
||||||
|
}
|
||||||
|
|
||||||
|
#clone_from_fn_token_stream
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Copy"</span>)]
|
||||||
|
</span><span class="kw">if </span>traits.contains(<span class="kw-2">&</span>Trait::Copy) {
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::marker::Copy <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
136
src/educe/trait_handlers/clone/clone_union.rs.html
Normal file
136
src/educe/trait_handlers/clone/clone_union.rs.html
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/clone/clone_union.rs`."><title>clone_union.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::quote;
|
||||||
|
<span class="kw">use </span>syn::{Data, DeriveInput, Meta};
|
||||||
|
|
||||||
|
<span class="kw">use super</span>::{
|
||||||
|
models::{FieldAttributeBuilder, TypeAttributeBuilder},
|
||||||
|
TraitHandler,
|
||||||
|
};
|
||||||
|
<span class="kw">use </span><span class="kw">crate</span>::supported_traits::Trait;
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>CloneUnionHandler;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TraitHandler <span class="kw">for </span>CloneUnionHandler {
|
||||||
|
<span class="kw">fn </span>trait_meta_handler(
|
||||||
|
ast: <span class="kw-2">&mut </span>DeriveInput,
|
||||||
|
token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream,
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
meta: <span class="kw-2">&</span>Meta,
|
||||||
|
) -> syn::Result<()> {
|
||||||
|
<span class="kw">let </span>type_attribute = TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">true</span>, enable_bound: <span class="bool-val">true
|
||||||
|
</span>}
|
||||||
|
.build_from_clone_meta(meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if let </span>Data::Union(data) = <span class="kw-2">&</span>ast.data {
|
||||||
|
<span class="kw">for </span>field <span class="kw">in </span>data.fields.named.iter() {
|
||||||
|
<span class="kw">let _ </span>= FieldAttributeBuilder {
|
||||||
|
enable_method: <span class="bool-val">false
|
||||||
|
</span>}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ast.ident;
|
||||||
|
|
||||||
|
<span class="kw">let </span>bound = type_attribute.bound.into_where_predicates_by_generic_parameters(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
<span class="kw-2">&</span>syn::parse2(<span class="macro">quote!</span>(::core::marker::Copy)).unwrap(),
|
||||||
|
);
|
||||||
|
|
||||||
|
<span class="kw">let </span>where_clause = ast.generics.make_where_clause();
|
||||||
|
|
||||||
|
<span class="kw">for </span>where_predicate <span class="kw">in </span>bound {
|
||||||
|
where_clause.predicates.push(where_predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>(impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
||||||
|
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::clone::Clone <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>clone(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="self">Self </span>{
|
||||||
|
<span class="kw-2">*</span><span class="self">self
|
||||||
|
</span>}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Copy"</span>)]
|
||||||
|
</span><span class="kw">if </span>traits.contains(<span class="kw-2">&</span>Trait::Copy) {
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::marker::Copy <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
74
src/educe/trait_handlers/clone/mod.rs.html
Normal file
74
src/educe/trait_handlers/clone/mod.rs.html
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/clone/mod.rs`."><title>mod.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">mod </span>clone_enum;
|
||||||
|
<span class="kw">mod </span>clone_struct;
|
||||||
|
<span class="kw">mod </span>clone_union;
|
||||||
|
<span class="kw">mod </span>models;
|
||||||
|
|
||||||
|
<span class="kw">use </span>syn::{Data, DeriveInput, Meta};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">super</span>::TraitHandler;
|
||||||
|
<span class="kw">use </span><span class="kw">crate</span>::Trait;
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>CloneHandler;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TraitHandler <span class="kw">for </span>CloneHandler {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>trait_meta_handler(
|
||||||
|
ast: <span class="kw-2">&mut </span>DeriveInput,
|
||||||
|
token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream,
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
meta: <span class="kw-2">&</span>Meta,
|
||||||
|
) -> syn::Result<()> {
|
||||||
|
<span class="kw">match </span>ast.data {
|
||||||
|
Data::Struct(<span class="kw">_</span>) => clone_struct::CloneStructHandler::trait_meta_handler(
|
||||||
|
ast,
|
||||||
|
token_stream,
|
||||||
|
traits,
|
||||||
|
meta,
|
||||||
|
),
|
||||||
|
Data::Enum(<span class="kw">_</span>) => {
|
||||||
|
clone_enum::CloneEnumHandler::trait_meta_handler(ast, token_stream, traits, meta)
|
||||||
|
},
|
||||||
|
Data::Union(<span class="kw">_</span>) => {
|
||||||
|
clone_union::CloneUnionHandler::trait_meta_handler(ast, token_stream, traits, meta)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
252
src/educe/trait_handlers/clone/models/field_attribute.rs.html
Normal file
252
src/educe/trait_handlers/clone/models/field_attribute.rs.html
Normal file
|
@ -0,0 +1,252 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/clone/models/field_attribute.rs`."><title>field_attribute.rs - source</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="educe" 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="../../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>syn::{punctuated::Punctuated, Attribute, Meta, Path, Token};
|
||||||
|
|
||||||
|
<span class="kw">use crate</span>::{common::path::meta_2_path, panic, supported_traits::Trait};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>FieldAttribute {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) method: <span class="prelude-ty">Option</span><Path>,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>FieldAttributeBuilder {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) enable_method: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>FieldAttributeBuilder {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>build_from_clone_meta(<span class="kw-2">&</span><span class="self">self</span>, meta: <span class="kw-2">&</span>Meta) -> syn::Result<FieldAttribute> {
|
||||||
|
<span class="macro">debug_assert!</span>(meta.path().is_ident(<span class="string">"Clone"</span>));
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>method = <span class="prelude-val">None</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span>correct_usage_for_clone_attribute = {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>usage = <span class="macro">vec!</span>[];
|
||||||
|
|
||||||
|
<span class="kw">if </span><span class="self">self</span>.enable_method {
|
||||||
|
usage.push(<span class="macro">stringify!</span>(<span class="attr">#[educe(Clone(method(path_to_method)))]</span>));
|
||||||
|
}
|
||||||
|
|
||||||
|
usage
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">match </span>meta {
|
||||||
|
Meta::Path(<span class="kw">_</span>) | Meta::NameValue(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::attribute_incorrect_format(
|
||||||
|
meta.path().get_ident().unwrap(),
|
||||||
|
<span class="kw-2">&</span>correct_usage_for_clone_attribute,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
Meta::List(list) => {
|
||||||
|
<span class="kw">let </span>result =
|
||||||
|
list.parse_args_with(Punctuated::<Meta, <span class="macro">Token!</span>[,]>::parse_terminated)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>method_is_set = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>handler = |meta: Meta| -> syn::Result<bool> {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(ident) = meta.path().get_ident() {
|
||||||
|
<span class="kw">if </span>ident == <span class="string">"method" </span>{
|
||||||
|
<span class="kw">if </span>!<span class="self">self</span>.enable_method {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="bool-val">false</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>v = meta_2_path(<span class="kw-2">&</span>meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>method_is_set {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::parameter_reset(ident));
|
||||||
|
}
|
||||||
|
|
||||||
|
method_is_set = <span class="bool-val">true</span>;
|
||||||
|
|
||||||
|
method = <span class="prelude-val">Some</span>(v);
|
||||||
|
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="bool-val">true</span>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(<span class="bool-val">false</span>)
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">for </span>p <span class="kw">in </span>result {
|
||||||
|
<span class="kw">if </span>!handler(p)<span class="question-mark">? </span>{
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::attribute_incorrect_format(
|
||||||
|
meta.path().get_ident().unwrap(),
|
||||||
|
<span class="kw-2">&</span>correct_usage_for_clone_attribute,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(FieldAttribute {
|
||||||
|
method,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>build_from_attributes(
|
||||||
|
<span class="kw-2">&</span><span class="self">self</span>,
|
||||||
|
attributes: <span class="kw-2">&</span>[Attribute],
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
) -> syn::Result<FieldAttribute> {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>output = <span class="prelude-val">None</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>attribute <span class="kw">in </span>attributes.iter() {
|
||||||
|
<span class="kw">let </span>path = attribute.path();
|
||||||
|
|
||||||
|
<span class="kw">if </span>path.is_ident(<span class="string">"educe"</span>) {
|
||||||
|
<span class="kw">if let </span>Meta::List(list) = <span class="kw-2">&</span>attribute.meta {
|
||||||
|
<span class="kw">let </span>result =
|
||||||
|
list.parse_args_with(Punctuated::<Meta, <span class="macro">Token!</span>[,]>::parse_terminated)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>meta <span class="kw">in </span>result {
|
||||||
|
<span class="kw">let </span>path = meta.path();
|
||||||
|
|
||||||
|
<span class="kw">let </span>t = <span class="kw">match </span>Trait::from_path(path) {
|
||||||
|
<span class="prelude-val">Some</span>(t) => t,
|
||||||
|
<span class="prelude-val">None </span>=> <span class="kw">return </span><span class="prelude-val">Err</span>(panic::unsupported_trait(meta.path())),
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">if </span>!traits.contains(<span class="kw-2">&</span>t) {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::trait_not_used(path.get_ident().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>t == Trait::Clone {
|
||||||
|
<span class="kw">if </span>output.is_some() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::reuse_a_trait(path.get_ident().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
output = <span class="prelude-val">Some</span>(<span class="self">self</span>.build_from_clone_meta(<span class="kw-2">&</span>meta)<span class="question-mark">?</span>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(output.unwrap_or(FieldAttribute {
|
||||||
|
method: <span class="prelude-val">None
|
||||||
|
</span>}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
12
src/educe/trait_handlers/clone/models/mod.rs.html
Normal file
12
src/educe/trait_handlers/clone/models/mod.rs.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/clone/models/mod.rs`."><title>mod.rs - source</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="educe" 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="../../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">mod </span>field_attribute;
|
||||||
|
<span class="kw">mod </span>type_attribute;
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">use </span>field_attribute::<span class="kw-2">*</span>;
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">use </span>type_attribute::<span class="kw-2">*</span>;
|
||||||
|
</code></pre></div></section></main></body></html>
|
282
src/educe/trait_handlers/clone/models/type_attribute.rs.html
Normal file
282
src/educe/trait_handlers/clone/models/type_attribute.rs.html
Normal file
|
@ -0,0 +1,282 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/clone/models/type_attribute.rs`."><title>type_attribute.rs - source</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="educe" 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="../../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
<a href="#136" id="136">136</a>
|
||||||
|
<a href="#137" id="137">137</a>
|
||||||
|
<a href="#138" id="138">138</a>
|
||||||
|
<a href="#139" id="139">139</a>
|
||||||
|
<a href="#140" id="140">140</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>syn::{punctuated::Punctuated, Attribute, Meta, Token};
|
||||||
|
|
||||||
|
<span class="kw">use crate</span>::{common::bound::Bound, panic, Trait};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>TypeAttribute {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) bound: Bound,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>TypeAttributeBuilder {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) enable_flag: bool,
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) enable_bound: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TypeAttributeBuilder {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>build_from_clone_meta(<span class="kw-2">&</span><span class="self">self</span>, meta: <span class="kw-2">&</span>Meta) -> syn::Result<TypeAttribute> {
|
||||||
|
<span class="macro">debug_assert!</span>(meta.path().is_ident(<span class="string">"Clone"</span>));
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>bound = Bound::Auto;
|
||||||
|
|
||||||
|
<span class="kw">let </span>correct_usage_for_clone_attribute = {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>usage = <span class="macro">vec!</span>[];
|
||||||
|
|
||||||
|
<span class="kw">if </span><span class="self">self</span>.enable_flag {
|
||||||
|
usage.push(<span class="macro">stringify!</span>(<span class="attr">#[educe(Clone)]</span>));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span><span class="self">self</span>.enable_bound {
|
||||||
|
usage.push(<span class="macro">stringify!</span>(<span class="attr">#[educe(Clone(bound(where_predicates)))]</span>));
|
||||||
|
usage.push(<span class="macro">stringify!</span>(<span class="attr">#[educe(Clone(bound = <span class="bool-val">false</span>))]</span>));
|
||||||
|
}
|
||||||
|
|
||||||
|
usage
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">match </span>meta {
|
||||||
|
Meta::Path(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">if </span>!<span class="self">self</span>.enable_flag {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::attribute_incorrect_format(
|
||||||
|
meta.path().get_ident().unwrap(),
|
||||||
|
<span class="kw-2">&</span>correct_usage_for_clone_attribute,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Meta::NameValue(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::attribute_incorrect_format(
|
||||||
|
meta.path().get_ident().unwrap(),
|
||||||
|
<span class="kw-2">&</span>correct_usage_for_clone_attribute,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
Meta::List(list) => {
|
||||||
|
<span class="kw">let </span>result =
|
||||||
|
list.parse_args_with(Punctuated::<Meta, <span class="macro">Token!</span>[,]>::parse_terminated)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>bound_is_set = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>handler = |meta: Meta| -> syn::Result<bool> {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(ident) = meta.path().get_ident() {
|
||||||
|
<span class="kw">if </span>ident == <span class="string">"bound" </span>{
|
||||||
|
<span class="kw">if </span>!<span class="self">self</span>.enable_bound {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="bool-val">false</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>v = Bound::from_meta(<span class="kw-2">&</span>meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>bound_is_set {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::parameter_reset(ident));
|
||||||
|
}
|
||||||
|
|
||||||
|
bound_is_set = <span class="bool-val">true</span>;
|
||||||
|
|
||||||
|
bound = v;
|
||||||
|
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="bool-val">true</span>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(<span class="bool-val">false</span>)
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">for </span>p <span class="kw">in </span>result {
|
||||||
|
<span class="kw">if </span>!handler(p)<span class="question-mark">? </span>{
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::attribute_incorrect_format(
|
||||||
|
meta.path().get_ident().unwrap(),
|
||||||
|
<span class="kw-2">&</span>correct_usage_for_clone_attribute,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(TypeAttribute {
|
||||||
|
bound,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>build_from_attributes(
|
||||||
|
<span class="kw-2">&</span><span class="self">self</span>,
|
||||||
|
attributes: <span class="kw-2">&</span>[Attribute],
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
) -> syn::Result<TypeAttribute> {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>output = <span class="prelude-val">None</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>attribute <span class="kw">in </span>attributes.iter() {
|
||||||
|
<span class="kw">let </span>path = attribute.path();
|
||||||
|
|
||||||
|
<span class="kw">if </span>path.is_ident(<span class="string">"educe"</span>) {
|
||||||
|
<span class="kw">if let </span>Meta::List(list) = <span class="kw-2">&</span>attribute.meta {
|
||||||
|
<span class="kw">let </span>result =
|
||||||
|
list.parse_args_with(Punctuated::<Meta, <span class="macro">Token!</span>[,]>::parse_terminated)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>meta <span class="kw">in </span>result {
|
||||||
|
<span class="kw">let </span>path = meta.path();
|
||||||
|
|
||||||
|
<span class="kw">let </span>t = <span class="kw">match </span>Trait::from_path(path) {
|
||||||
|
<span class="prelude-val">Some</span>(t) => t,
|
||||||
|
<span class="prelude-val">None </span>=> <span class="kw">return </span><span class="prelude-val">Err</span>(panic::unsupported_trait(meta.path())),
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">if </span>!traits.contains(<span class="kw-2">&</span>t) {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::trait_not_used(path.get_ident().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>t == Trait::Clone {
|
||||||
|
<span class="kw">if </span>output.is_some() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::reuse_a_trait(path.get_ident().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
output = <span class="prelude-val">Some</span>(<span class="self">self</span>.build_from_clone_meta(<span class="kw-2">&</span>meta)<span class="question-mark">?</span>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(output.unwrap_or(TypeAttribute {
|
||||||
|
bound: Bound::Auto
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
196
src/educe/trait_handlers/copy/mod.rs.html
Normal file
196
src/educe/trait_handlers/copy/mod.rs.html
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/copy/mod.rs`."><title>mod.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">mod </span>models;
|
||||||
|
|
||||||
|
<span class="kw">use </span>models::{FieldAttributeBuilder, TypeAttributeBuilder};
|
||||||
|
<span class="kw">use </span>quote::quote;
|
||||||
|
<span class="kw">use </span>syn::{Data, DeriveInput, Meta};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">super</span>::TraitHandler;
|
||||||
|
<span class="kw">use </span><span class="kw">crate</span>::Trait;
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>CopyHandler;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TraitHandler <span class="kw">for </span>CopyHandler {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>trait_meta_handler(
|
||||||
|
ast: <span class="kw-2">&mut </span>DeriveInput,
|
||||||
|
token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream,
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
meta: <span class="kw-2">&</span>Meta,
|
||||||
|
) -> syn::Result<()> {
|
||||||
|
<span class="attr">#[cfg(feature = <span class="string">"Clone"</span>)]
|
||||||
|
</span><span class="kw">let </span>contains_clone = traits.contains(<span class="kw-2">&</span>Trait::Clone);
|
||||||
|
|
||||||
|
<span class="attr">#[cfg(not(feature = <span class="string">"Clone"</span>))]
|
||||||
|
</span><span class="kw">let </span>contains_clone = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span>type_attribute = TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">true</span>,
|
||||||
|
enable_bound: !contains_clone,
|
||||||
|
}
|
||||||
|
.build_from_copy_meta(meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="comment">// if `contains_clone` is true, the implementation is handled by the `Clone` attribute, and field attributes is also handled by the `Clone` attribute
|
||||||
|
</span><span class="kw">if </span>!contains_clone {
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>ast.data {
|
||||||
|
Data::Struct(data) => {
|
||||||
|
<span class="kw">for </span>field <span class="kw">in </span>data.fields.iter() {
|
||||||
|
<span class="kw">let _ </span>=
|
||||||
|
FieldAttributeBuilder.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Data::Enum(data) => {
|
||||||
|
<span class="kw">for </span>variant <span class="kw">in </span>data.variants.iter() {
|
||||||
|
<span class="kw">let _ </span>= TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">false</span>, enable_bound: <span class="bool-val">false
|
||||||
|
</span>}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>variant.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>field <span class="kw">in </span>variant.fields.iter() {
|
||||||
|
<span class="kw">let _ </span>= FieldAttributeBuilder
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Data::Union(data) => {
|
||||||
|
<span class="kw">for </span>field <span class="kw">in </span>data.fields.named.iter() {
|
||||||
|
<span class="kw">let _ </span>=
|
||||||
|
FieldAttributeBuilder.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ast.ident;
|
||||||
|
|
||||||
|
<span class="comment">/*
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct B<T> {
|
||||||
|
f1: PhantomData<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Copy for B<T> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// The above code will throw a compile error because T have to be bound to `Copy`. However, it seems not to be necessary logically.
|
||||||
|
*/
|
||||||
|
</span><span class="kw">let </span>bound = type_attribute.bound.into_where_predicates_by_generic_parameters(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
<span class="kw-2">&</span>syn::parse2(<span class="macro">quote!</span>(::core::marker::Copy)).unwrap(),
|
||||||
|
);
|
||||||
|
|
||||||
|
<span class="kw">let </span>where_clause = ast.generics.make_where_clause();
|
||||||
|
|
||||||
|
<span class="kw">for </span>where_predicate <span class="kw">in </span>bound {
|
||||||
|
where_clause.predicates.push(where_predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>(impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
||||||
|
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::marker::Copy <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
116
src/educe/trait_handlers/copy/models/field_attribute.rs.html
Normal file
116
src/educe/trait_handlers/copy/models/field_attribute.rs.html
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/copy/models/field_attribute.rs`."><title>field_attribute.rs - source</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="educe" 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="../../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>syn::{punctuated::Punctuated, Attribute, Meta, Token};
|
||||||
|
|
||||||
|
<span class="kw">use crate</span>::{panic, supported_traits::Trait};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>FieldAttribute;
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>FieldAttributeBuilder;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>FieldAttributeBuilder {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>build_from_copy_meta(<span class="kw-2">&</span><span class="self">self</span>, meta: <span class="kw-2">&</span>Meta) -> syn::Result<FieldAttribute> {
|
||||||
|
<span class="macro">debug_assert!</span>(meta.path().is_ident(<span class="string">"Copy"</span>));
|
||||||
|
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::attribute_incorrect_place(meta.path().get_ident().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>build_from_attributes(
|
||||||
|
<span class="kw-2">&</span><span class="self">self</span>,
|
||||||
|
attributes: <span class="kw-2">&</span>[Attribute],
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
) -> syn::Result<FieldAttribute> {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>output = <span class="prelude-val">None</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>attribute <span class="kw">in </span>attributes.iter() {
|
||||||
|
<span class="kw">let </span>path = attribute.path();
|
||||||
|
|
||||||
|
<span class="kw">if </span>path.is_ident(<span class="string">"educe"</span>) {
|
||||||
|
<span class="kw">if let </span>Meta::List(list) = <span class="kw-2">&</span>attribute.meta {
|
||||||
|
<span class="kw">let </span>result =
|
||||||
|
list.parse_args_with(Punctuated::<Meta, <span class="macro">Token!</span>[,]>::parse_terminated)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>meta <span class="kw">in </span>result {
|
||||||
|
<span class="kw">let </span>path = meta.path();
|
||||||
|
|
||||||
|
<span class="kw">let </span>t = <span class="kw">match </span>Trait::from_path(path) {
|
||||||
|
<span class="prelude-val">Some</span>(t) => t,
|
||||||
|
<span class="prelude-val">None </span>=> <span class="kw">return </span><span class="prelude-val">Err</span>(panic::unsupported_trait(meta.path())),
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">if </span>!traits.contains(<span class="kw-2">&</span>t) {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::trait_not_used(path.get_ident().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>t == Trait::Copy {
|
||||||
|
<span class="kw">if </span>output.is_some() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::reuse_a_trait(path.get_ident().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
output = <span class="prelude-val">Some</span>(<span class="self">self</span>.build_from_copy_meta(<span class="kw-2">&</span>meta)<span class="question-mark">?</span>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(output.unwrap_or(FieldAttribute))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
12
src/educe/trait_handlers/copy/models/mod.rs.html
Normal file
12
src/educe/trait_handlers/copy/models/mod.rs.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/copy/models/mod.rs`."><title>mod.rs - source</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="educe" 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="../../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">mod </span>field_attribute;
|
||||||
|
<span class="kw">mod </span>type_attribute;
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">use </span>field_attribute::<span class="kw-2">*</span>;
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">use </span>type_attribute::<span class="kw-2">*</span>;
|
||||||
|
</code></pre></div></section></main></body></html>
|
282
src/educe/trait_handlers/copy/models/type_attribute.rs.html
Normal file
282
src/educe/trait_handlers/copy/models/type_attribute.rs.html
Normal file
|
@ -0,0 +1,282 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/copy/models/type_attribute.rs`."><title>type_attribute.rs - source</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="educe" 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="../../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
<a href="#136" id="136">136</a>
|
||||||
|
<a href="#137" id="137">137</a>
|
||||||
|
<a href="#138" id="138">138</a>
|
||||||
|
<a href="#139" id="139">139</a>
|
||||||
|
<a href="#140" id="140">140</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>syn::{punctuated::Punctuated, Attribute, Meta, Token};
|
||||||
|
|
||||||
|
<span class="kw">use crate</span>::{common::bound::Bound, panic, Trait};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>TypeAttribute {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) bound: Bound,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[derive(Debug)]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>TypeAttributeBuilder {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) enable_flag: bool,
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) enable_bound: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TypeAttributeBuilder {
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>build_from_copy_meta(<span class="kw-2">&</span><span class="self">self</span>, meta: <span class="kw-2">&</span>Meta) -> syn::Result<TypeAttribute> {
|
||||||
|
<span class="macro">debug_assert!</span>(meta.path().is_ident(<span class="string">"Copy"</span>));
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>bound = Bound::Auto;
|
||||||
|
|
||||||
|
<span class="kw">let </span>correct_usage_for_copy_attribute = {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>usage = <span class="macro">vec!</span>[];
|
||||||
|
|
||||||
|
<span class="kw">if </span><span class="self">self</span>.enable_flag {
|
||||||
|
usage.push(<span class="macro">stringify!</span>(<span class="attr">#[educe(Copy)]</span>));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span><span class="self">self</span>.enable_bound {
|
||||||
|
usage.push(<span class="macro">stringify!</span>(<span class="attr">#[educe(Copy(bound(where_predicates)))]</span>));
|
||||||
|
usage.push(<span class="macro">stringify!</span>(<span class="attr">#[educe(Copy(bound = <span class="bool-val">false</span>))]</span>));
|
||||||
|
}
|
||||||
|
|
||||||
|
usage
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">match </span>meta {
|
||||||
|
Meta::Path(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">if </span>!<span class="self">self</span>.enable_flag {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::attribute_incorrect_format(
|
||||||
|
meta.path().get_ident().unwrap(),
|
||||||
|
<span class="kw-2">&</span>correct_usage_for_copy_attribute,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Meta::NameValue(<span class="kw">_</span>) => {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::attribute_incorrect_format(
|
||||||
|
meta.path().get_ident().unwrap(),
|
||||||
|
<span class="kw-2">&</span>correct_usage_for_copy_attribute,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
Meta::List(list) => {
|
||||||
|
<span class="kw">let </span>result =
|
||||||
|
list.parse_args_with(Punctuated::<Meta, <span class="macro">Token!</span>[,]>::parse_terminated)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>bound_is_set = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>handler = |meta: Meta| -> syn::Result<bool> {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(ident) = meta.path().get_ident() {
|
||||||
|
<span class="kw">if </span>ident == <span class="string">"bound" </span>{
|
||||||
|
<span class="kw">if </span>!<span class="self">self</span>.enable_bound {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="bool-val">false</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>v = Bound::from_meta(<span class="kw-2">&</span>meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>bound_is_set {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::parameter_reset(ident));
|
||||||
|
}
|
||||||
|
|
||||||
|
bound_is_set = <span class="bool-val">true</span>;
|
||||||
|
|
||||||
|
bound = v;
|
||||||
|
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Ok</span>(<span class="bool-val">true</span>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(<span class="bool-val">false</span>)
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">for </span>p <span class="kw">in </span>result {
|
||||||
|
<span class="kw">if </span>!handler(p)<span class="question-mark">? </span>{
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::attribute_incorrect_format(
|
||||||
|
meta.path().get_ident().unwrap(),
|
||||||
|
<span class="kw-2">&</span>correct_usage_for_copy_attribute,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(TypeAttribute {
|
||||||
|
bound,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>build_from_attributes(
|
||||||
|
<span class="kw-2">&</span><span class="self">self</span>,
|
||||||
|
attributes: <span class="kw-2">&</span>[Attribute],
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
) -> syn::Result<TypeAttribute> {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>output = <span class="prelude-val">None</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>attribute <span class="kw">in </span>attributes.iter() {
|
||||||
|
<span class="kw">let </span>path = attribute.path();
|
||||||
|
|
||||||
|
<span class="kw">if </span>path.is_ident(<span class="string">"educe"</span>) {
|
||||||
|
<span class="kw">if let </span>Meta::List(list) = <span class="kw-2">&</span>attribute.meta {
|
||||||
|
<span class="kw">let </span>result =
|
||||||
|
list.parse_args_with(Punctuated::<Meta, <span class="macro">Token!</span>[,]>::parse_terminated)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">for </span>meta <span class="kw">in </span>result {
|
||||||
|
<span class="kw">let </span>path = meta.path();
|
||||||
|
|
||||||
|
<span class="kw">let </span>t = <span class="kw">match </span>Trait::from_path(path) {
|
||||||
|
<span class="prelude-val">Some</span>(t) => t,
|
||||||
|
<span class="prelude-val">None </span>=> <span class="kw">return </span><span class="prelude-val">Err</span>(panic::unsupported_trait(meta.path())),
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">if </span>!traits.contains(<span class="kw-2">&</span>t) {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::trait_not_used(path.get_ident().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>t == Trait::Copy {
|
||||||
|
<span class="kw">if </span>output.is_some() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(panic::reuse_a_trait(path.get_ident().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
output = <span class="prelude-val">Some</span>(<span class="self">self</span>.build_from_copy_meta(<span class="kw-2">&</span>meta)<span class="question-mark">?</span>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(output.unwrap_or(TypeAttribute {
|
||||||
|
bound: Bound::Auto
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
128
src/educe/trait_handlers/debug/common.rs.html
Normal file
128
src/educe/trait_handlers/debug/common.rs.html
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/debug/common.rs`."><title>common.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>std::collections::HashSet;
|
||||||
|
|
||||||
|
<span class="kw">use </span>quote::quote;
|
||||||
|
<span class="kw">use </span>syn::{punctuated::Punctuated, token::Comma, GenericParam, Path, Type};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">crate</span>::common::r#type::{dereference, find_idents_in_type};
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>create_debug_map_builder() -> proc_macro2::TokenStream {
|
||||||
|
<span class="macro">quote!</span>(
|
||||||
|
<span class="kw">struct </span>RawString(<span class="kw-2">&</span><span class="lifetime">'static </span>str);
|
||||||
|
|
||||||
|
<span class="kw">impl </span>::core::fmt::Debug <span class="kw">for </span>RawString {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>::core::fmt::Formatter<<span class="lifetime">'_</span>>) -> ::core::fmt::Result {
|
||||||
|
f.write_str(<span class="self">self</span>.<span class="number">0</span>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>builder = f.debug_map();
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>create_format_arg(
|
||||||
|
params: <span class="kw-2">&</span>Punctuated<GenericParam, Comma>,
|
||||||
|
ty: <span class="kw-2">&</span>Type,
|
||||||
|
format_method: <span class="kw-2">&</span>Path,
|
||||||
|
field: proc_macro2::TokenStream,
|
||||||
|
) -> proc_macro2::TokenStream {
|
||||||
|
<span class="kw">let </span>ty = dereference(ty);
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>idents = HashSet::new();
|
||||||
|
find_idents_in_type(<span class="kw-2">&mut </span>idents, ty, <span class="prelude-val">Some</span>((<span class="bool-val">true</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>)));
|
||||||
|
|
||||||
|
<span class="comment">// simply support one level generics (without considering bounds that use other generics)
|
||||||
|
</span><span class="kw">let </span><span class="kw-2">mut </span>filtered_params: Punctuated<GenericParam, Comma> = Punctuated::new();
|
||||||
|
|
||||||
|
<span class="kw">for </span>param <span class="kw">in </span>params.iter() {
|
||||||
|
<span class="kw">if let </span>GenericParam::Type(ty) = param {
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ty.ident;
|
||||||
|
|
||||||
|
<span class="kw">if </span>idents.contains(ident) {
|
||||||
|
filtered_params.push(param.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="macro">quote!</span>(
|
||||||
|
<span class="kw">let </span>arg = {
|
||||||
|
<span class="kw">struct </span>MyDebug<<span class="lifetime">'a</span>, #filtered_params>(<span class="kw-2">&</span><span class="lifetime">'a </span>#ty);
|
||||||
|
|
||||||
|
<span class="kw">impl</span><<span class="lifetime">'a</span>, #filtered_params> ::core::fmt::Debug <span class="kw">for </span>MyDebug<<span class="lifetime">'a</span>, #filtered_params> {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>::core::fmt::Formatter<<span class="lifetime">'_</span>>) -> ::core::fmt::Result {
|
||||||
|
#format_method(<span class="self">self</span>.<span class="number">0</span>, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyDebug(#field)
|
||||||
|
};
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
742
src/educe/trait_handlers/debug/debug_enum.rs.html
Normal file
742
src/educe/trait_handlers/debug/debug_enum.rs.html
Normal file
|
@ -0,0 +1,742 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/debug/debug_enum.rs`."><title>debug_enum.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
<a href="#136" id="136">136</a>
|
||||||
|
<a href="#137" id="137">137</a>
|
||||||
|
<a href="#138" id="138">138</a>
|
||||||
|
<a href="#139" id="139">139</a>
|
||||||
|
<a href="#140" id="140">140</a>
|
||||||
|
<a href="#141" id="141">141</a>
|
||||||
|
<a href="#142" id="142">142</a>
|
||||||
|
<a href="#143" id="143">143</a>
|
||||||
|
<a href="#144" id="144">144</a>
|
||||||
|
<a href="#145" id="145">145</a>
|
||||||
|
<a href="#146" id="146">146</a>
|
||||||
|
<a href="#147" id="147">147</a>
|
||||||
|
<a href="#148" id="148">148</a>
|
||||||
|
<a href="#149" id="149">149</a>
|
||||||
|
<a href="#150" id="150">150</a>
|
||||||
|
<a href="#151" id="151">151</a>
|
||||||
|
<a href="#152" id="152">152</a>
|
||||||
|
<a href="#153" id="153">153</a>
|
||||||
|
<a href="#154" id="154">154</a>
|
||||||
|
<a href="#155" id="155">155</a>
|
||||||
|
<a href="#156" id="156">156</a>
|
||||||
|
<a href="#157" id="157">157</a>
|
||||||
|
<a href="#158" id="158">158</a>
|
||||||
|
<a href="#159" id="159">159</a>
|
||||||
|
<a href="#160" id="160">160</a>
|
||||||
|
<a href="#161" id="161">161</a>
|
||||||
|
<a href="#162" id="162">162</a>
|
||||||
|
<a href="#163" id="163">163</a>
|
||||||
|
<a href="#164" id="164">164</a>
|
||||||
|
<a href="#165" id="165">165</a>
|
||||||
|
<a href="#166" id="166">166</a>
|
||||||
|
<a href="#167" id="167">167</a>
|
||||||
|
<a href="#168" id="168">168</a>
|
||||||
|
<a href="#169" id="169">169</a>
|
||||||
|
<a href="#170" id="170">170</a>
|
||||||
|
<a href="#171" id="171">171</a>
|
||||||
|
<a href="#172" id="172">172</a>
|
||||||
|
<a href="#173" id="173">173</a>
|
||||||
|
<a href="#174" id="174">174</a>
|
||||||
|
<a href="#175" id="175">175</a>
|
||||||
|
<a href="#176" id="176">176</a>
|
||||||
|
<a href="#177" id="177">177</a>
|
||||||
|
<a href="#178" id="178">178</a>
|
||||||
|
<a href="#179" id="179">179</a>
|
||||||
|
<a href="#180" id="180">180</a>
|
||||||
|
<a href="#181" id="181">181</a>
|
||||||
|
<a href="#182" id="182">182</a>
|
||||||
|
<a href="#183" id="183">183</a>
|
||||||
|
<a href="#184" id="184">184</a>
|
||||||
|
<a href="#185" id="185">185</a>
|
||||||
|
<a href="#186" id="186">186</a>
|
||||||
|
<a href="#187" id="187">187</a>
|
||||||
|
<a href="#188" id="188">188</a>
|
||||||
|
<a href="#189" id="189">189</a>
|
||||||
|
<a href="#190" id="190">190</a>
|
||||||
|
<a href="#191" id="191">191</a>
|
||||||
|
<a href="#192" id="192">192</a>
|
||||||
|
<a href="#193" id="193">193</a>
|
||||||
|
<a href="#194" id="194">194</a>
|
||||||
|
<a href="#195" id="195">195</a>
|
||||||
|
<a href="#196" id="196">196</a>
|
||||||
|
<a href="#197" id="197">197</a>
|
||||||
|
<a href="#198" id="198">198</a>
|
||||||
|
<a href="#199" id="199">199</a>
|
||||||
|
<a href="#200" id="200">200</a>
|
||||||
|
<a href="#201" id="201">201</a>
|
||||||
|
<a href="#202" id="202">202</a>
|
||||||
|
<a href="#203" id="203">203</a>
|
||||||
|
<a href="#204" id="204">204</a>
|
||||||
|
<a href="#205" id="205">205</a>
|
||||||
|
<a href="#206" id="206">206</a>
|
||||||
|
<a href="#207" id="207">207</a>
|
||||||
|
<a href="#208" id="208">208</a>
|
||||||
|
<a href="#209" id="209">209</a>
|
||||||
|
<a href="#210" id="210">210</a>
|
||||||
|
<a href="#211" id="211">211</a>
|
||||||
|
<a href="#212" id="212">212</a>
|
||||||
|
<a href="#213" id="213">213</a>
|
||||||
|
<a href="#214" id="214">214</a>
|
||||||
|
<a href="#215" id="215">215</a>
|
||||||
|
<a href="#216" id="216">216</a>
|
||||||
|
<a href="#217" id="217">217</a>
|
||||||
|
<a href="#218" id="218">218</a>
|
||||||
|
<a href="#219" id="219">219</a>
|
||||||
|
<a href="#220" id="220">220</a>
|
||||||
|
<a href="#221" id="221">221</a>
|
||||||
|
<a href="#222" id="222">222</a>
|
||||||
|
<a href="#223" id="223">223</a>
|
||||||
|
<a href="#224" id="224">224</a>
|
||||||
|
<a href="#225" id="225">225</a>
|
||||||
|
<a href="#226" id="226">226</a>
|
||||||
|
<a href="#227" id="227">227</a>
|
||||||
|
<a href="#228" id="228">228</a>
|
||||||
|
<a href="#229" id="229">229</a>
|
||||||
|
<a href="#230" id="230">230</a>
|
||||||
|
<a href="#231" id="231">231</a>
|
||||||
|
<a href="#232" id="232">232</a>
|
||||||
|
<a href="#233" id="233">233</a>
|
||||||
|
<a href="#234" id="234">234</a>
|
||||||
|
<a href="#235" id="235">235</a>
|
||||||
|
<a href="#236" id="236">236</a>
|
||||||
|
<a href="#237" id="237">237</a>
|
||||||
|
<a href="#238" id="238">238</a>
|
||||||
|
<a href="#239" id="239">239</a>
|
||||||
|
<a href="#240" id="240">240</a>
|
||||||
|
<a href="#241" id="241">241</a>
|
||||||
|
<a href="#242" id="242">242</a>
|
||||||
|
<a href="#243" id="243">243</a>
|
||||||
|
<a href="#244" id="244">244</a>
|
||||||
|
<a href="#245" id="245">245</a>
|
||||||
|
<a href="#246" id="246">246</a>
|
||||||
|
<a href="#247" id="247">247</a>
|
||||||
|
<a href="#248" id="248">248</a>
|
||||||
|
<a href="#249" id="249">249</a>
|
||||||
|
<a href="#250" id="250">250</a>
|
||||||
|
<a href="#251" id="251">251</a>
|
||||||
|
<a href="#252" id="252">252</a>
|
||||||
|
<a href="#253" id="253">253</a>
|
||||||
|
<a href="#254" id="254">254</a>
|
||||||
|
<a href="#255" id="255">255</a>
|
||||||
|
<a href="#256" id="256">256</a>
|
||||||
|
<a href="#257" id="257">257</a>
|
||||||
|
<a href="#258" id="258">258</a>
|
||||||
|
<a href="#259" id="259">259</a>
|
||||||
|
<a href="#260" id="260">260</a>
|
||||||
|
<a href="#261" id="261">261</a>
|
||||||
|
<a href="#262" id="262">262</a>
|
||||||
|
<a href="#263" id="263">263</a>
|
||||||
|
<a href="#264" id="264">264</a>
|
||||||
|
<a href="#265" id="265">265</a>
|
||||||
|
<a href="#266" id="266">266</a>
|
||||||
|
<a href="#267" id="267">267</a>
|
||||||
|
<a href="#268" id="268">268</a>
|
||||||
|
<a href="#269" id="269">269</a>
|
||||||
|
<a href="#270" id="270">270</a>
|
||||||
|
<a href="#271" id="271">271</a>
|
||||||
|
<a href="#272" id="272">272</a>
|
||||||
|
<a href="#273" id="273">273</a>
|
||||||
|
<a href="#274" id="274">274</a>
|
||||||
|
<a href="#275" id="275">275</a>
|
||||||
|
<a href="#276" id="276">276</a>
|
||||||
|
<a href="#277" id="277">277</a>
|
||||||
|
<a href="#278" id="278">278</a>
|
||||||
|
<a href="#279" id="279">279</a>
|
||||||
|
<a href="#280" id="280">280</a>
|
||||||
|
<a href="#281" id="281">281</a>
|
||||||
|
<a href="#282" id="282">282</a>
|
||||||
|
<a href="#283" id="283">283</a>
|
||||||
|
<a href="#284" id="284">284</a>
|
||||||
|
<a href="#285" id="285">285</a>
|
||||||
|
<a href="#286" id="286">286</a>
|
||||||
|
<a href="#287" id="287">287</a>
|
||||||
|
<a href="#288" id="288">288</a>
|
||||||
|
<a href="#289" id="289">289</a>
|
||||||
|
<a href="#290" id="290">290</a>
|
||||||
|
<a href="#291" id="291">291</a>
|
||||||
|
<a href="#292" id="292">292</a>
|
||||||
|
<a href="#293" id="293">293</a>
|
||||||
|
<a href="#294" id="294">294</a>
|
||||||
|
<a href="#295" id="295">295</a>
|
||||||
|
<a href="#296" id="296">296</a>
|
||||||
|
<a href="#297" id="297">297</a>
|
||||||
|
<a href="#298" id="298">298</a>
|
||||||
|
<a href="#299" id="299">299</a>
|
||||||
|
<a href="#300" id="300">300</a>
|
||||||
|
<a href="#301" id="301">301</a>
|
||||||
|
<a href="#302" id="302">302</a>
|
||||||
|
<a href="#303" id="303">303</a>
|
||||||
|
<a href="#304" id="304">304</a>
|
||||||
|
<a href="#305" id="305">305</a>
|
||||||
|
<a href="#306" id="306">306</a>
|
||||||
|
<a href="#307" id="307">307</a>
|
||||||
|
<a href="#308" id="308">308</a>
|
||||||
|
<a href="#309" id="309">309</a>
|
||||||
|
<a href="#310" id="310">310</a>
|
||||||
|
<a href="#311" id="311">311</a>
|
||||||
|
<a href="#312" id="312">312</a>
|
||||||
|
<a href="#313" id="313">313</a>
|
||||||
|
<a href="#314" id="314">314</a>
|
||||||
|
<a href="#315" id="315">315</a>
|
||||||
|
<a href="#316" id="316">316</a>
|
||||||
|
<a href="#317" id="317">317</a>
|
||||||
|
<a href="#318" id="318">318</a>
|
||||||
|
<a href="#319" id="319">319</a>
|
||||||
|
<a href="#320" id="320">320</a>
|
||||||
|
<a href="#321" id="321">321</a>
|
||||||
|
<a href="#322" id="322">322</a>
|
||||||
|
<a href="#323" id="323">323</a>
|
||||||
|
<a href="#324" id="324">324</a>
|
||||||
|
<a href="#325" id="325">325</a>
|
||||||
|
<a href="#326" id="326">326</a>
|
||||||
|
<a href="#327" id="327">327</a>
|
||||||
|
<a href="#328" id="328">328</a>
|
||||||
|
<a href="#329" id="329">329</a>
|
||||||
|
<a href="#330" id="330">330</a>
|
||||||
|
<a href="#331" id="331">331</a>
|
||||||
|
<a href="#332" id="332">332</a>
|
||||||
|
<a href="#333" id="333">333</a>
|
||||||
|
<a href="#334" id="334">334</a>
|
||||||
|
<a href="#335" id="335">335</a>
|
||||||
|
<a href="#336" id="336">336</a>
|
||||||
|
<a href="#337" id="337">337</a>
|
||||||
|
<a href="#338" id="338">338</a>
|
||||||
|
<a href="#339" id="339">339</a>
|
||||||
|
<a href="#340" id="340">340</a>
|
||||||
|
<a href="#341" id="341">341</a>
|
||||||
|
<a href="#342" id="342">342</a>
|
||||||
|
<a href="#343" id="343">343</a>
|
||||||
|
<a href="#344" id="344">344</a>
|
||||||
|
<a href="#345" id="345">345</a>
|
||||||
|
<a href="#346" id="346">346</a>
|
||||||
|
<a href="#347" id="347">347</a>
|
||||||
|
<a href="#348" id="348">348</a>
|
||||||
|
<a href="#349" id="349">349</a>
|
||||||
|
<a href="#350" id="350">350</a>
|
||||||
|
<a href="#351" id="351">351</a>
|
||||||
|
<a href="#352" id="352">352</a>
|
||||||
|
<a href="#353" id="353">353</a>
|
||||||
|
<a href="#354" id="354">354</a>
|
||||||
|
<a href="#355" id="355">355</a>
|
||||||
|
<a href="#356" id="356">356</a>
|
||||||
|
<a href="#357" id="357">357</a>
|
||||||
|
<a href="#358" id="358">358</a>
|
||||||
|
<a href="#359" id="359">359</a>
|
||||||
|
<a href="#360" id="360">360</a>
|
||||||
|
<a href="#361" id="361">361</a>
|
||||||
|
<a href="#362" id="362">362</a>
|
||||||
|
<a href="#363" id="363">363</a>
|
||||||
|
<a href="#364" id="364">364</a>
|
||||||
|
<a href="#365" id="365">365</a>
|
||||||
|
<a href="#366" id="366">366</a>
|
||||||
|
<a href="#367" id="367">367</a>
|
||||||
|
<a href="#368" id="368">368</a>
|
||||||
|
<a href="#369" id="369">369</a>
|
||||||
|
<a href="#370" id="370">370</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::{format_ident, quote, ToTokens};
|
||||||
|
<span class="kw">use </span>syn::{Data, DeriveInput, Fields, Meta, Type};
|
||||||
|
|
||||||
|
<span class="kw">use </span><span class="kw">super</span>::models::{FieldAttributeBuilder, FieldName, TypeAttributeBuilder, TypeName};
|
||||||
|
<span class="kw">use crate</span>::{common::path::path_to_string, supported_traits::Trait, trait_handlers::TraitHandler};
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>DebugEnumHandler;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TraitHandler <span class="kw">for </span>DebugEnumHandler {
|
||||||
|
<span class="kw">fn </span>trait_meta_handler(
|
||||||
|
ast: <span class="kw-2">&mut </span>DeriveInput,
|
||||||
|
token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream,
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
meta: <span class="kw-2">&</span>Meta,
|
||||||
|
) -> syn::Result<()> {
|
||||||
|
<span class="kw">let </span>type_attribute = TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">true</span>,
|
||||||
|
enable_unsafe: <span class="bool-val">false</span>,
|
||||||
|
enable_name: <span class="bool-val">true</span>,
|
||||||
|
enable_named_field: <span class="bool-val">false</span>,
|
||||||
|
enable_bound: <span class="bool-val">true</span>,
|
||||||
|
name: TypeName::Disable,
|
||||||
|
named_field: <span class="bool-val">false</span>,
|
||||||
|
}
|
||||||
|
.build_from_debug_meta(meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span>name = type_attribute.name.to_ident_by_ident(<span class="kw-2">&</span>ast.ident);
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>debug_types: Vec<<span class="kw-2">&</span>Type> = Vec::new();
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>builder_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>arms_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">if let </span>Data::Enum(data) = <span class="kw-2">&</span>ast.data {
|
||||||
|
<span class="kw">for </span>variant <span class="kw">in </span>data.variants.iter() {
|
||||||
|
<span class="kw">let </span>type_attribute = TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">false</span>,
|
||||||
|
enable_unsafe: <span class="bool-val">false</span>,
|
||||||
|
enable_name: <span class="bool-val">true</span>,
|
||||||
|
enable_named_field: <span class="bool-val">true</span>,
|
||||||
|
enable_bound: <span class="bool-val">false</span>,
|
||||||
|
name: TypeName::Default,
|
||||||
|
named_field: <span class="macro">matches!</span>(<span class="kw-2">&</span>variant.fields, Fields::Named(<span class="kw">_</span>)),
|
||||||
|
}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>variant.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span>variant_ident = <span class="kw-2">&</span>variant.ident;
|
||||||
|
|
||||||
|
<span class="kw">let </span>variant_name = type_attribute.name.to_ident_by_ident(variant_ident);
|
||||||
|
|
||||||
|
<span class="kw">let </span>named_field = type_attribute.named_field;
|
||||||
|
|
||||||
|
<span class="kw">let </span>name_string = <span class="kw">if let </span><span class="prelude-val">Some</span>(name) = name {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(variant_name) = variant_name {
|
||||||
|
<span class="prelude-val">Some</span>(path_to_string(<span class="kw-2">&</span>syn::parse2(<span class="macro">quote!</span>(#name::#variant_name)).unwrap()))
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="prelude-val">Some</span>(name.into_token_stream().to_string())
|
||||||
|
}
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
variant_name.map(|variant_name| variant_name.into_token_stream().to_string())
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">match </span><span class="kw-2">&</span>variant.fields {
|
||||||
|
Fields::Unit => {
|
||||||
|
<span class="kw">if </span>name_string.is_none() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">super</span>::panic::unit_variant_need_name(variant));
|
||||||
|
}
|
||||||
|
|
||||||
|
arms_token_stream
|
||||||
|
.extend(<span class="macro">quote!</span>( <span class="self">Self</span>::#variant_ident => f.write_str(#name_string), ));
|
||||||
|
},
|
||||||
|
Fields::Named(fields) => {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>has_fields = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>pattern_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>block_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">if </span>named_field {
|
||||||
|
block_token_stream
|
||||||
|
.extend(create_named_field_builder(name_string.as_deref()));
|
||||||
|
|
||||||
|
<span class="kw">for </span>field <span class="kw">in </span>fields.named.iter() {
|
||||||
|
<span class="kw">let </span>field_attribute = FieldAttributeBuilder {
|
||||||
|
enable_name: <span class="bool-val">true</span>,
|
||||||
|
enable_ignore: <span class="bool-val">true</span>,
|
||||||
|
enable_method: <span class="bool-val">true</span>,
|
||||||
|
name: FieldName::Default,
|
||||||
|
}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span>field_name_real = field.ident.as_ref().unwrap();
|
||||||
|
<span class="kw">let </span>field_name_var = <span class="macro">format_ident!</span>(<span class="string">"_{}"</span>, field_name_real);
|
||||||
|
|
||||||
|
<span class="kw">if </span>field_attribute.ignore {
|
||||||
|
pattern_token_stream.extend(<span class="macro">quote!</span>(#field_name_real: <span class="kw">_</span>,));
|
||||||
|
|
||||||
|
<span class="kw">continue</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>key = <span class="kw">match </span>field_attribute.name {
|
||||||
|
FieldName::Custom(name) => name,
|
||||||
|
FieldName::Default => field_name_real.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
|
pattern_token_stream
|
||||||
|
.extend(<span class="macro">quote!</span>(#field_name_real: #field_name_var,));
|
||||||
|
|
||||||
|
<span class="kw">let </span>ty = <span class="kw-2">&</span>field.ty;
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(method) = field_attribute.method {
|
||||||
|
block_token_stream.extend(<span class="kw">super</span>::common::create_format_arg(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
ty,
|
||||||
|
<span class="kw-2">&</span>method,
|
||||||
|
<span class="macro">quote!</span>(#field_name_var),
|
||||||
|
));
|
||||||
|
|
||||||
|
block_token_stream.extend(<span class="kw">if </span>name_string.is_some() {
|
||||||
|
<span class="macro">quote! </span>(builder.field(<span class="macro">stringify!</span>(#key), <span class="kw-2">&</span>arg);)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="macro">quote! </span>(builder.entry(<span class="kw-2">&</span>RawString(<span class="macro">stringify!</span>(#key)), <span class="kw-2">&</span>arg);)
|
||||||
|
});
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
debug_types.push(ty);
|
||||||
|
|
||||||
|
block_token_stream.extend(<span class="kw">if </span>name_string.is_some() {
|
||||||
|
<span class="macro">quote! </span>(builder.field(<span class="macro">stringify!</span>(#key), #field_name_var);)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="macro">quote! </span>(builder.entry(<span class="kw-2">&</span>RawString(<span class="macro">stringify!</span>(#key)), #field_name_var);)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
has_fields = <span class="bool-val">true</span>;
|
||||||
|
}
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
block_token_stream
|
||||||
|
.extend(<span class="macro">quote!</span>(<span class="kw">let </span><span class="kw-2">mut </span>builder = f.debug_tuple(#name_string);));
|
||||||
|
|
||||||
|
<span class="kw">for </span>field <span class="kw">in </span>fields.named.iter() {
|
||||||
|
<span class="kw">let </span>field_attribute = FieldAttributeBuilder {
|
||||||
|
enable_name: <span class="bool-val">false</span>,
|
||||||
|
enable_ignore: <span class="bool-val">true</span>,
|
||||||
|
enable_method: <span class="bool-val">true</span>,
|
||||||
|
name: FieldName::Default,
|
||||||
|
}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span>field_name_real = field.ident.as_ref().unwrap();
|
||||||
|
<span class="kw">let </span>field_name_var = <span class="macro">format_ident!</span>(<span class="string">"_{}"</span>, field_name_real);
|
||||||
|
|
||||||
|
<span class="kw">if </span>field_attribute.ignore {
|
||||||
|
pattern_token_stream.extend(<span class="macro">quote!</span>(#field_name_real: <span class="kw">_</span>,));
|
||||||
|
|
||||||
|
<span class="kw">continue</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pattern_token_stream
|
||||||
|
.extend(<span class="macro">quote!</span>(#field_name_real: #field_name_var,));
|
||||||
|
|
||||||
|
<span class="kw">let </span>ty = <span class="kw-2">&</span>field.ty;
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(method) = field_attribute.method {
|
||||||
|
block_token_stream.extend(<span class="kw">super</span>::common::create_format_arg(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
ty,
|
||||||
|
<span class="kw-2">&</span>method,
|
||||||
|
<span class="macro">quote!</span>(#field_name_var),
|
||||||
|
));
|
||||||
|
|
||||||
|
block_token_stream.extend(<span class="macro">quote! </span>(builder.field(<span class="kw-2">&</span>arg);));
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
debug_types.push(ty);
|
||||||
|
|
||||||
|
block_token_stream
|
||||||
|
.extend(<span class="macro">quote! </span>(builder.field(#field_name_var);));
|
||||||
|
}
|
||||||
|
|
||||||
|
has_fields = <span class="bool-val">true</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>!has_fields && name_string.is_none() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">super</span>::panic::unit_struct_need_name(variant_ident));
|
||||||
|
}
|
||||||
|
|
||||||
|
arms_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="self">Self</span>::#variant_ident { #pattern_token_stream } => {
|
||||||
|
#block_token_stream
|
||||||
|
|
||||||
|
builder.finish()
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
Fields::Unnamed(fields) => {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>has_fields = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>pattern_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>block_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">if </span>named_field {
|
||||||
|
block_token_stream
|
||||||
|
.extend(create_named_field_builder(name_string.as_deref()));
|
||||||
|
|
||||||
|
<span class="kw">for </span>(index, field) <span class="kw">in </span>fields.unnamed.iter().enumerate() {
|
||||||
|
<span class="kw">let </span>field_attribute = FieldAttributeBuilder {
|
||||||
|
enable_name: <span class="bool-val">true</span>,
|
||||||
|
enable_ignore: <span class="bool-val">true</span>,
|
||||||
|
enable_method: <span class="bool-val">true</span>,
|
||||||
|
name: FieldName::Default,
|
||||||
|
}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>field_attribute.ignore {
|
||||||
|
pattern_token_stream.extend(<span class="macro">quote!</span>(<span class="kw">_</span>,));
|
||||||
|
|
||||||
|
<span class="kw">continue</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>field_name_var = <span class="macro">format_ident!</span>(<span class="string">"_{}"</span>, index);
|
||||||
|
|
||||||
|
<span class="kw">let </span>key = <span class="kw">match </span>field_attribute.name {
|
||||||
|
FieldName::Custom(name) => name,
|
||||||
|
FieldName::Default => field_name_var.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
|
pattern_token_stream.extend(<span class="macro">quote!</span>(#field_name_var,));
|
||||||
|
|
||||||
|
<span class="kw">let </span>ty = <span class="kw-2">&</span>field.ty;
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(method) = field_attribute.method {
|
||||||
|
block_token_stream.extend(<span class="kw">super</span>::common::create_format_arg(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
ty,
|
||||||
|
<span class="kw-2">&</span>method,
|
||||||
|
<span class="macro">quote!</span>(#field_name_var),
|
||||||
|
));
|
||||||
|
|
||||||
|
block_token_stream.extend(<span class="kw">if </span>name_string.is_some() {
|
||||||
|
<span class="macro">quote! </span>(builder.field(<span class="macro">stringify!</span>(#key), <span class="kw-2">&</span>arg);)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="macro">quote! </span>(builder.entry(<span class="kw-2">&</span>RawString(<span class="macro">stringify!</span>(#key)), <span class="kw-2">&</span>arg);)
|
||||||
|
});
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
debug_types.push(ty);
|
||||||
|
|
||||||
|
block_token_stream.extend(<span class="kw">if </span>name_string.is_some() {
|
||||||
|
<span class="macro">quote! </span>(builder.field(<span class="macro">stringify!</span>(#key), #field_name_var);)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="macro">quote! </span>(builder.entry(<span class="kw-2">&</span>RawString(<span class="macro">stringify!</span>(#key)), #field_name_var);)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
has_fields = <span class="bool-val">true</span>;
|
||||||
|
}
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
block_token_stream
|
||||||
|
.extend(<span class="macro">quote!</span>(<span class="kw">let </span><span class="kw-2">mut </span>builder = f.debug_tuple(#name_string);));
|
||||||
|
|
||||||
|
<span class="kw">for </span>(index, field) <span class="kw">in </span>fields.unnamed.iter().enumerate() {
|
||||||
|
<span class="kw">let </span>field_attribute = FieldAttributeBuilder {
|
||||||
|
enable_name: <span class="bool-val">false</span>,
|
||||||
|
enable_ignore: <span class="bool-val">true</span>,
|
||||||
|
enable_method: <span class="bool-val">true</span>,
|
||||||
|
name: FieldName::Default,
|
||||||
|
}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>field_attribute.ignore {
|
||||||
|
pattern_token_stream.extend(<span class="macro">quote!</span>(<span class="kw">_</span>,));
|
||||||
|
|
||||||
|
<span class="kw">continue</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>field_name_var = <span class="macro">format_ident!</span>(<span class="string">"_{}"</span>, index);
|
||||||
|
|
||||||
|
pattern_token_stream.extend(<span class="macro">quote!</span>(#field_name_var,));
|
||||||
|
|
||||||
|
<span class="kw">let </span>ty = <span class="kw-2">&</span>field.ty;
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(method) = field_attribute.method {
|
||||||
|
block_token_stream.extend(<span class="kw">super</span>::common::create_format_arg(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
ty,
|
||||||
|
<span class="kw-2">&</span>method,
|
||||||
|
<span class="macro">quote!</span>(#field_name_var),
|
||||||
|
));
|
||||||
|
|
||||||
|
block_token_stream.extend(<span class="macro">quote! </span>(builder.field(<span class="kw-2">&</span>arg);));
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
debug_types.push(ty);
|
||||||
|
|
||||||
|
block_token_stream
|
||||||
|
.extend(<span class="macro">quote! </span>(builder.field(#field_name_var);));
|
||||||
|
}
|
||||||
|
|
||||||
|
has_fields = <span class="bool-val">true</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if </span>!has_fields && name_string.is_none() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">super</span>::panic::unit_struct_need_name(variant_ident));
|
||||||
|
}
|
||||||
|
|
||||||
|
arms_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="self">Self</span>::#variant_ident ( #pattern_token_stream ) => {
|
||||||
|
#block_token_stream
|
||||||
|
|
||||||
|
builder.finish()
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ast.ident;
|
||||||
|
|
||||||
|
<span class="kw">if </span>arms_token_stream.is_empty() {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(ident) = name {
|
||||||
|
builder_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
f.write_str(<span class="macro">stringify!</span>(#ident))
|
||||||
|
});
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">super</span>::panic::unit_enum_need_name(ident));
|
||||||
|
}
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
builder_token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">match </span><span class="self">self </span>{
|
||||||
|
#arms_token_stream
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>bound = type_attribute.bound.into_where_predicates_by_generic_parameters_check_types(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
<span class="kw-2">&</span>syn::parse2(<span class="macro">quote!</span>(::core::fmt::Debug)).unwrap(),
|
||||||
|
<span class="kw-2">&</span>debug_types,
|
||||||
|
<span class="prelude-val">Some</span>((<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>)),
|
||||||
|
);
|
||||||
|
|
||||||
|
<span class="kw">let </span>where_clause = ast.generics.make_where_clause();
|
||||||
|
|
||||||
|
<span class="kw">for </span>where_predicate <span class="kw">in </span>bound {
|
||||||
|
where_clause.predicates.push(where_predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>(impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
||||||
|
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::fmt::Debug <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||||
|
#builder_token_stream
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>create_named_field_builder(name_string: <span class="prelude-ty">Option</span><<span class="kw-2">&</span>str>) -> proc_macro2::TokenStream {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(name_string) = name_string {
|
||||||
|
<span class="macro">quote!</span>(<span class="kw">let </span><span class="kw-2">mut </span>builder = f.debug_struct(#name_string);)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">super</span>::common::create_debug_map_builder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
370
src/educe/trait_handlers/debug/debug_struct.rs.html
Normal file
370
src/educe/trait_handlers/debug/debug_struct.rs.html
Normal file
|
@ -0,0 +1,370 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/debug/debug_struct.rs`."><title>debug_struct.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
<a href="#87" id="87">87</a>
|
||||||
|
<a href="#88" id="88">88</a>
|
||||||
|
<a href="#89" id="89">89</a>
|
||||||
|
<a href="#90" id="90">90</a>
|
||||||
|
<a href="#91" id="91">91</a>
|
||||||
|
<a href="#92" id="92">92</a>
|
||||||
|
<a href="#93" id="93">93</a>
|
||||||
|
<a href="#94" id="94">94</a>
|
||||||
|
<a href="#95" id="95">95</a>
|
||||||
|
<a href="#96" id="96">96</a>
|
||||||
|
<a href="#97" id="97">97</a>
|
||||||
|
<a href="#98" id="98">98</a>
|
||||||
|
<a href="#99" id="99">99</a>
|
||||||
|
<a href="#100" id="100">100</a>
|
||||||
|
<a href="#101" id="101">101</a>
|
||||||
|
<a href="#102" id="102">102</a>
|
||||||
|
<a href="#103" id="103">103</a>
|
||||||
|
<a href="#104" id="104">104</a>
|
||||||
|
<a href="#105" id="105">105</a>
|
||||||
|
<a href="#106" id="106">106</a>
|
||||||
|
<a href="#107" id="107">107</a>
|
||||||
|
<a href="#108" id="108">108</a>
|
||||||
|
<a href="#109" id="109">109</a>
|
||||||
|
<a href="#110" id="110">110</a>
|
||||||
|
<a href="#111" id="111">111</a>
|
||||||
|
<a href="#112" id="112">112</a>
|
||||||
|
<a href="#113" id="113">113</a>
|
||||||
|
<a href="#114" id="114">114</a>
|
||||||
|
<a href="#115" id="115">115</a>
|
||||||
|
<a href="#116" id="116">116</a>
|
||||||
|
<a href="#117" id="117">117</a>
|
||||||
|
<a href="#118" id="118">118</a>
|
||||||
|
<a href="#119" id="119">119</a>
|
||||||
|
<a href="#120" id="120">120</a>
|
||||||
|
<a href="#121" id="121">121</a>
|
||||||
|
<a href="#122" id="122">122</a>
|
||||||
|
<a href="#123" id="123">123</a>
|
||||||
|
<a href="#124" id="124">124</a>
|
||||||
|
<a href="#125" id="125">125</a>
|
||||||
|
<a href="#126" id="126">126</a>
|
||||||
|
<a href="#127" id="127">127</a>
|
||||||
|
<a href="#128" id="128">128</a>
|
||||||
|
<a href="#129" id="129">129</a>
|
||||||
|
<a href="#130" id="130">130</a>
|
||||||
|
<a href="#131" id="131">131</a>
|
||||||
|
<a href="#132" id="132">132</a>
|
||||||
|
<a href="#133" id="133">133</a>
|
||||||
|
<a href="#134" id="134">134</a>
|
||||||
|
<a href="#135" id="135">135</a>
|
||||||
|
<a href="#136" id="136">136</a>
|
||||||
|
<a href="#137" id="137">137</a>
|
||||||
|
<a href="#138" id="138">138</a>
|
||||||
|
<a href="#139" id="139">139</a>
|
||||||
|
<a href="#140" id="140">140</a>
|
||||||
|
<a href="#141" id="141">141</a>
|
||||||
|
<a href="#142" id="142">142</a>
|
||||||
|
<a href="#143" id="143">143</a>
|
||||||
|
<a href="#144" id="144">144</a>
|
||||||
|
<a href="#145" id="145">145</a>
|
||||||
|
<a href="#146" id="146">146</a>
|
||||||
|
<a href="#147" id="147">147</a>
|
||||||
|
<a href="#148" id="148">148</a>
|
||||||
|
<a href="#149" id="149">149</a>
|
||||||
|
<a href="#150" id="150">150</a>
|
||||||
|
<a href="#151" id="151">151</a>
|
||||||
|
<a href="#152" id="152">152</a>
|
||||||
|
<a href="#153" id="153">153</a>
|
||||||
|
<a href="#154" id="154">154</a>
|
||||||
|
<a href="#155" id="155">155</a>
|
||||||
|
<a href="#156" id="156">156</a>
|
||||||
|
<a href="#157" id="157">157</a>
|
||||||
|
<a href="#158" id="158">158</a>
|
||||||
|
<a href="#159" id="159">159</a>
|
||||||
|
<a href="#160" id="160">160</a>
|
||||||
|
<a href="#161" id="161">161</a>
|
||||||
|
<a href="#162" id="162">162</a>
|
||||||
|
<a href="#163" id="163">163</a>
|
||||||
|
<a href="#164" id="164">164</a>
|
||||||
|
<a href="#165" id="165">165</a>
|
||||||
|
<a href="#166" id="166">166</a>
|
||||||
|
<a href="#167" id="167">167</a>
|
||||||
|
<a href="#168" id="168">168</a>
|
||||||
|
<a href="#169" id="169">169</a>
|
||||||
|
<a href="#170" id="170">170</a>
|
||||||
|
<a href="#171" id="171">171</a>
|
||||||
|
<a href="#172" id="172">172</a>
|
||||||
|
<a href="#173" id="173">173</a>
|
||||||
|
<a href="#174" id="174">174</a>
|
||||||
|
<a href="#175" id="175">175</a>
|
||||||
|
<a href="#176" id="176">176</a>
|
||||||
|
<a href="#177" id="177">177</a>
|
||||||
|
<a href="#178" id="178">178</a>
|
||||||
|
<a href="#179" id="179">179</a>
|
||||||
|
<a href="#180" id="180">180</a>
|
||||||
|
<a href="#181" id="181">181</a>
|
||||||
|
<a href="#182" id="182">182</a>
|
||||||
|
<a href="#183" id="183">183</a>
|
||||||
|
<a href="#184" id="184">184</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::{format_ident, quote};
|
||||||
|
<span class="kw">use </span>syn::{Data, DeriveInput, Fields, Meta, Type};
|
||||||
|
|
||||||
|
<span class="kw">use super</span>::{
|
||||||
|
models::{FieldAttributeBuilder, FieldName, TypeAttributeBuilder, TypeName},
|
||||||
|
TraitHandler,
|
||||||
|
};
|
||||||
|
<span class="kw">use crate</span>::{common::ident_index::IdentOrIndex, Trait};
|
||||||
|
|
||||||
|
<span class="kw">pub struct </span>DebugStructHandler;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TraitHandler <span class="kw">for </span>DebugStructHandler {
|
||||||
|
<span class="kw">fn </span>trait_meta_handler(
|
||||||
|
ast: <span class="kw-2">&mut </span>DeriveInput,
|
||||||
|
token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream,
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
meta: <span class="kw-2">&</span>Meta,
|
||||||
|
) -> syn::Result<()> {
|
||||||
|
<span class="kw">let </span>is_tuple = {
|
||||||
|
<span class="kw">if let </span>Data::Struct(data) = <span class="kw-2">&</span>ast.data {
|
||||||
|
<span class="macro">matches!</span>(data.fields, Fields::Unnamed(<span class="kw">_</span>))
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="bool-val">true
|
||||||
|
</span>}
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">let </span>type_attribute = TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">true</span>,
|
||||||
|
enable_unsafe: <span class="bool-val">false</span>,
|
||||||
|
enable_name: <span class="bool-val">true</span>,
|
||||||
|
enable_named_field: <span class="bool-val">true</span>,
|
||||||
|
enable_bound: <span class="bool-val">true</span>,
|
||||||
|
name: TypeName::Default,
|
||||||
|
named_field: !is_tuple,
|
||||||
|
}
|
||||||
|
.build_from_debug_meta(meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">let </span>name = type_attribute.name.to_ident_by_ident(<span class="kw-2">&</span>ast.ident);
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>debug_types: Vec<<span class="kw-2">&</span>Type> = Vec::new();
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>builder_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>has_fields = <span class="bool-val">false</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>type_attribute.named_field {
|
||||||
|
builder_token_stream.extend(<span class="kw">if let </span><span class="prelude-val">Some</span>(name) = name {
|
||||||
|
<span class="macro">quote!</span>(<span class="kw">let </span><span class="kw-2">mut </span>builder = f.debug_struct(<span class="macro">stringify!</span>(#name));)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="kw">super</span>::common::create_debug_map_builder()
|
||||||
|
});
|
||||||
|
|
||||||
|
<span class="kw">if let </span>Data::Struct(data) = <span class="kw-2">&</span>ast.data {
|
||||||
|
<span class="kw">for </span>(index, field) <span class="kw">in </span>data.fields.iter().enumerate() {
|
||||||
|
<span class="kw">let </span>field_attribute = FieldAttributeBuilder {
|
||||||
|
enable_name: <span class="bool-val">true</span>,
|
||||||
|
enable_ignore: <span class="bool-val">true</span>,
|
||||||
|
enable_method: <span class="bool-val">true</span>,
|
||||||
|
name: FieldName::Default,
|
||||||
|
}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>field_attribute.ignore {
|
||||||
|
<span class="kw">continue</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>(key, field_name) = <span class="kw">match </span>field_attribute.name {
|
||||||
|
FieldName::Custom(name) => {
|
||||||
|
(name, IdentOrIndex::from_ident_with_index(field.ident.as_ref(), index))
|
||||||
|
},
|
||||||
|
FieldName::Default => {
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(ident) = field.ident.as_ref() {
|
||||||
|
(ident.clone(), IdentOrIndex::from(ident))
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
(<span class="macro">format_ident!</span>(<span class="string">"_{}"</span>, index), IdentOrIndex::from(index))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="kw">let </span>ty = <span class="kw-2">&</span>field.ty;
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(method) = field_attribute.method {
|
||||||
|
builder_token_stream.extend(<span class="kw">super</span>::common::create_format_arg(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
ty,
|
||||||
|
<span class="kw-2">&</span>method,
|
||||||
|
<span class="macro">quote!</span>(<span class="kw-2">&</span><span class="self">self</span>.#field_name),
|
||||||
|
));
|
||||||
|
|
||||||
|
builder_token_stream.extend(<span class="kw">if </span>name.is_some() {
|
||||||
|
<span class="macro">quote! </span>(builder.field(<span class="macro">stringify!</span>(#key), <span class="kw-2">&</span>arg);)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="macro">quote! </span>(builder.entry(<span class="kw-2">&</span>RawString(<span class="macro">stringify!</span>(#key)), <span class="kw-2">&</span>arg);)
|
||||||
|
});
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
debug_types.push(ty);
|
||||||
|
|
||||||
|
builder_token_stream.extend(<span class="kw">if </span>name.is_some() {
|
||||||
|
<span class="macro">quote! </span>(builder.field(<span class="macro">stringify!</span>(#key), <span class="kw-2">&</span><span class="self">self</span>.#field_name);)
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
<span class="macro">quote! </span>(builder.entry(<span class="kw-2">&</span>RawString(<span class="macro">stringify!</span>(#key)), <span class="kw-2">&</span><span class="self">self</span>.#field_name);)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
has_fields = <span class="bool-val">true</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
builder_token_stream
|
||||||
|
.extend(<span class="macro">quote!</span>(<span class="kw">let </span><span class="kw-2">mut </span>builder = f.debug_tuple(<span class="macro">stringify!</span>(#name));));
|
||||||
|
|
||||||
|
<span class="kw">if let </span>Data::Struct(data) = <span class="kw-2">&</span>ast.data {
|
||||||
|
<span class="kw">for </span>(index, field) <span class="kw">in </span>data.fields.iter().enumerate() {
|
||||||
|
<span class="kw">let </span>field_attribute = FieldAttributeBuilder {
|
||||||
|
enable_name: <span class="bool-val">false</span>,
|
||||||
|
enable_ignore: <span class="bool-val">true</span>,
|
||||||
|
enable_method: <span class="bool-val">true</span>,
|
||||||
|
name: FieldName::Default,
|
||||||
|
}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>field_attribute.ignore {
|
||||||
|
<span class="kw">continue</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>field_name =
|
||||||
|
IdentOrIndex::from_ident_with_index(field.ident.as_ref(), index);
|
||||||
|
|
||||||
|
<span class="kw">let </span>ty = <span class="kw-2">&</span>field.ty;
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(method) = field_attribute.method {
|
||||||
|
builder_token_stream.extend(<span class="kw">super</span>::common::create_format_arg(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
ty,
|
||||||
|
<span class="kw-2">&</span>method,
|
||||||
|
<span class="macro">quote!</span>(<span class="kw-2">&</span><span class="self">self</span>.#field_name),
|
||||||
|
));
|
||||||
|
|
||||||
|
builder_token_stream.extend(<span class="macro">quote! </span>(builder.field(<span class="kw-2">&</span>arg);));
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
debug_types.push(ty);
|
||||||
|
|
||||||
|
builder_token_stream.extend(<span class="macro">quote! </span>(builder.field(<span class="kw-2">&</span><span class="self">self</span>.#field_name);));
|
||||||
|
}
|
||||||
|
|
||||||
|
has_fields = <span class="bool-val">true</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ast.ident;
|
||||||
|
|
||||||
|
<span class="kw">if </span>!has_fields && name.is_none() {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">super</span>::panic::unit_struct_need_name(ident));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>bound = type_attribute.bound.into_where_predicates_by_generic_parameters_check_types(
|
||||||
|
<span class="kw-2">&</span>ast.generics.params,
|
||||||
|
<span class="kw-2">&</span>syn::parse2(<span class="macro">quote!</span>(::core::fmt::Debug)).unwrap(),
|
||||||
|
<span class="kw-2">&</span>debug_types,
|
||||||
|
<span class="prelude-val">Some</span>((<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>)),
|
||||||
|
);
|
||||||
|
|
||||||
|
<span class="kw">let </span>where_clause = ast.generics.make_where_clause();
|
||||||
|
|
||||||
|
<span class="kw">for </span>where_predicate <span class="kw">in </span>bound {
|
||||||
|
where_clause.predicates.push(where_predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>(impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
||||||
|
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::fmt::Debug <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||||
|
#builder_token_stream
|
||||||
|
|
||||||
|
builder.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
174
src/educe/trait_handlers/debug/debug_union.rs.html
Normal file
174
src/educe/trait_handlers/debug/debug_union.rs.html
Normal file
|
@ -0,0 +1,174 @@
|
||||||
|
<!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="Source of the Rust file `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/educe-0.5.11/src/trait_handlers/debug/debug_union.rs`."><title>debug_union.rs - source</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="educe" 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="../../../../static.files/src-script-39ed315d46fb705f.js"></script><script defer src="../../../../src-files.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><div class="sidebar-resizer"></div>
|
||||||
|
<main><nav class="sub"><form class="search-form"><span></span><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="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||||
|
<a href="#2" id="2">2</a>
|
||||||
|
<a href="#3" id="3">3</a>
|
||||||
|
<a href="#4" id="4">4</a>
|
||||||
|
<a href="#5" id="5">5</a>
|
||||||
|
<a href="#6" id="6">6</a>
|
||||||
|
<a href="#7" id="7">7</a>
|
||||||
|
<a href="#8" id="8">8</a>
|
||||||
|
<a href="#9" id="9">9</a>
|
||||||
|
<a href="#10" id="10">10</a>
|
||||||
|
<a href="#11" id="11">11</a>
|
||||||
|
<a href="#12" id="12">12</a>
|
||||||
|
<a href="#13" id="13">13</a>
|
||||||
|
<a href="#14" id="14">14</a>
|
||||||
|
<a href="#15" id="15">15</a>
|
||||||
|
<a href="#16" id="16">16</a>
|
||||||
|
<a href="#17" id="17">17</a>
|
||||||
|
<a href="#18" id="18">18</a>
|
||||||
|
<a href="#19" id="19">19</a>
|
||||||
|
<a href="#20" id="20">20</a>
|
||||||
|
<a href="#21" id="21">21</a>
|
||||||
|
<a href="#22" id="22">22</a>
|
||||||
|
<a href="#23" id="23">23</a>
|
||||||
|
<a href="#24" id="24">24</a>
|
||||||
|
<a href="#25" id="25">25</a>
|
||||||
|
<a href="#26" id="26">26</a>
|
||||||
|
<a href="#27" id="27">27</a>
|
||||||
|
<a href="#28" id="28">28</a>
|
||||||
|
<a href="#29" id="29">29</a>
|
||||||
|
<a href="#30" id="30">30</a>
|
||||||
|
<a href="#31" id="31">31</a>
|
||||||
|
<a href="#32" id="32">32</a>
|
||||||
|
<a href="#33" id="33">33</a>
|
||||||
|
<a href="#34" id="34">34</a>
|
||||||
|
<a href="#35" id="35">35</a>
|
||||||
|
<a href="#36" id="36">36</a>
|
||||||
|
<a href="#37" id="37">37</a>
|
||||||
|
<a href="#38" id="38">38</a>
|
||||||
|
<a href="#39" id="39">39</a>
|
||||||
|
<a href="#40" id="40">40</a>
|
||||||
|
<a href="#41" id="41">41</a>
|
||||||
|
<a href="#42" id="42">42</a>
|
||||||
|
<a href="#43" id="43">43</a>
|
||||||
|
<a href="#44" id="44">44</a>
|
||||||
|
<a href="#45" id="45">45</a>
|
||||||
|
<a href="#46" id="46">46</a>
|
||||||
|
<a href="#47" id="47">47</a>
|
||||||
|
<a href="#48" id="48">48</a>
|
||||||
|
<a href="#49" id="49">49</a>
|
||||||
|
<a href="#50" id="50">50</a>
|
||||||
|
<a href="#51" id="51">51</a>
|
||||||
|
<a href="#52" id="52">52</a>
|
||||||
|
<a href="#53" id="53">53</a>
|
||||||
|
<a href="#54" id="54">54</a>
|
||||||
|
<a href="#55" id="55">55</a>
|
||||||
|
<a href="#56" id="56">56</a>
|
||||||
|
<a href="#57" id="57">57</a>
|
||||||
|
<a href="#58" id="58">58</a>
|
||||||
|
<a href="#59" id="59">59</a>
|
||||||
|
<a href="#60" id="60">60</a>
|
||||||
|
<a href="#61" id="61">61</a>
|
||||||
|
<a href="#62" id="62">62</a>
|
||||||
|
<a href="#63" id="63">63</a>
|
||||||
|
<a href="#64" id="64">64</a>
|
||||||
|
<a href="#65" id="65">65</a>
|
||||||
|
<a href="#66" id="66">66</a>
|
||||||
|
<a href="#67" id="67">67</a>
|
||||||
|
<a href="#68" id="68">68</a>
|
||||||
|
<a href="#69" id="69">69</a>
|
||||||
|
<a href="#70" id="70">70</a>
|
||||||
|
<a href="#71" id="71">71</a>
|
||||||
|
<a href="#72" id="72">72</a>
|
||||||
|
<a href="#73" id="73">73</a>
|
||||||
|
<a href="#74" id="74">74</a>
|
||||||
|
<a href="#75" id="75">75</a>
|
||||||
|
<a href="#76" id="76">76</a>
|
||||||
|
<a href="#77" id="77">77</a>
|
||||||
|
<a href="#78" id="78">78</a>
|
||||||
|
<a href="#79" id="79">79</a>
|
||||||
|
<a href="#80" id="80">80</a>
|
||||||
|
<a href="#81" id="81">81</a>
|
||||||
|
<a href="#82" id="82">82</a>
|
||||||
|
<a href="#83" id="83">83</a>
|
||||||
|
<a href="#84" id="84">84</a>
|
||||||
|
<a href="#85" id="85">85</a>
|
||||||
|
<a href="#86" id="86">86</a>
|
||||||
|
</pre></div><pre class="rust"><code><span class="kw">use </span>quote::quote;
|
||||||
|
<span class="kw">use </span>syn::{Data, DeriveInput, Meta};
|
||||||
|
|
||||||
|
<span class="kw">use super</span>::{
|
||||||
|
models::{FieldAttributeBuilder, FieldName, TypeAttributeBuilder, TypeName},
|
||||||
|
TraitHandler,
|
||||||
|
};
|
||||||
|
<span class="kw">use </span><span class="kw">crate</span>::supported_traits::Trait;
|
||||||
|
|
||||||
|
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>DebugUnionHandler;
|
||||||
|
|
||||||
|
<span class="kw">impl </span>TraitHandler <span class="kw">for </span>DebugUnionHandler {
|
||||||
|
<span class="kw">fn </span>trait_meta_handler(
|
||||||
|
ast: <span class="kw-2">&mut </span>DeriveInput,
|
||||||
|
token_stream: <span class="kw-2">&mut </span>proc_macro2::TokenStream,
|
||||||
|
traits: <span class="kw-2">&</span>[Trait],
|
||||||
|
meta: <span class="kw-2">&</span>Meta,
|
||||||
|
) -> syn::Result<()> {
|
||||||
|
<span class="kw">let </span>type_attribute = TypeAttributeBuilder {
|
||||||
|
enable_flag: <span class="bool-val">true</span>,
|
||||||
|
enable_unsafe: <span class="bool-val">true</span>,
|
||||||
|
enable_name: <span class="bool-val">true</span>,
|
||||||
|
enable_named_field: <span class="bool-val">false</span>,
|
||||||
|
enable_bound: <span class="bool-val">false</span>,
|
||||||
|
name: TypeName::Default,
|
||||||
|
named_field: <span class="bool-val">false</span>,
|
||||||
|
}
|
||||||
|
.build_from_debug_meta(meta)<span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>!type_attribute.has_unsafe {
|
||||||
|
<span class="kw">return </span><span class="prelude-val">Err</span>(<span class="kw">super</span>::panic::union_without_unsafe(meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>name = type_attribute.name.to_ident_by_ident(<span class="kw-2">&</span>ast.ident);
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>builder_token_stream = proc_macro2::TokenStream::new();
|
||||||
|
|
||||||
|
<span class="kw">if let </span>Data::Union(data) = <span class="kw-2">&</span>ast.data {
|
||||||
|
<span class="kw">for </span>field <span class="kw">in </span>data.fields.named.iter() {
|
||||||
|
<span class="kw">let _ </span>= FieldAttributeBuilder {
|
||||||
|
enable_name: <span class="bool-val">false</span>,
|
||||||
|
enable_ignore: <span class="bool-val">false</span>,
|
||||||
|
enable_method: <span class="bool-val">false</span>,
|
||||||
|
name: FieldName::Default,
|
||||||
|
}
|
||||||
|
.build_from_attributes(<span class="kw-2">&</span>field.attrs, traits)<span class="question-mark">?</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">if let </span><span class="prelude-val">Some</span>(name) = name {
|
||||||
|
builder_token_stream.extend(<span class="macro">quote!</span>(
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>builder = f.debug_tuple(<span class="macro">stringify!</span>(#name));
|
||||||
|
|
||||||
|
<span class="kw">let </span>size = ::core::mem::size_of::<<span class="self">Self</span>>();
|
||||||
|
|
||||||
|
<span class="kw">let </span>data = <span class="kw">unsafe </span>{ ::core::slice::from_raw_parts(<span class="self">self </span><span class="kw">as </span><span class="kw-2">*const </span><span class="self">Self </span><span class="kw">as </span><span class="kw-2">*const </span>u8, size) };
|
||||||
|
|
||||||
|
builder.field(<span class="kw-2">&</span>data);
|
||||||
|
|
||||||
|
builder.finish()
|
||||||
|
));
|
||||||
|
} <span class="kw">else </span>{
|
||||||
|
builder_token_stream.extend(<span class="macro">quote!</span>(
|
||||||
|
<span class="kw">let </span>size = ::core::mem::size_of::<<span class="self">Self</span>>();
|
||||||
|
<span class="kw">let </span>data = <span class="kw">unsafe </span>{ ::core::slice::from_raw_parts(<span class="self">self </span><span class="kw">as </span><span class="kw-2">*const </span><span class="self">Self </span><span class="kw">as </span><span class="kw-2">*const </span>u8, size) };
|
||||||
|
|
||||||
|
::core::fmt::Debug::fmt(data, f)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="kw">let </span>ident = <span class="kw-2">&</span>ast.ident;
|
||||||
|
|
||||||
|
<span class="kw">let </span>(impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
||||||
|
|
||||||
|
token_stream.extend(<span class="macro">quote! </span>{
|
||||||
|
<span class="kw">impl </span>#impl_generics ::core::fmt::Debug <span class="kw">for </span>#ident #ty_generics #where_clause {
|
||||||
|
<span class="attr">#[inline]
|
||||||
|
</span><span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>::core::fmt::Formatter<<span class="lifetime">'_</span>>) -> ::core::fmt::Result {
|
||||||
|
#builder_token_stream
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
<span class="prelude-val">Ok</span>(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre></div></section></main></body></html>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue