Skip to content

Commit bd2d584

Browse files
committed
deploy: f8c735e
1 parent fa894ed commit bd2d584

4 files changed

Lines changed: 13 additions & 21 deletions

File tree

eventually_macros/attr.aggregate_root.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!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="Implements a newtype to use the `eventually::aggregate::Root` instance with user-defined `eventually::aggregate::Aggregate` types."><title>aggregate_root in eventually_macros - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-46132b98.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="eventually_macros" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.1 (4eb161250 2025-03-15)" data-channel="1.85.1" data-search-js="search-75f5ac3e.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc attr"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../eventually_macros/index.html">eventually_<wbr>macros</a><span class="version">0.1.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">aggregate_<wbr>root</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#context" title="Context">Context</a></li><li><a href="#panics" title="Panics">Panics</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate eventually_<wbr>macros</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">eventually_macros</a></span><h1>Attribute Macro <span class="attr">aggregate_root</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/eventually_macros/lib.rs.html#33-83">Source</a> </span></div><pre class="rust item-decl"><code>#[aggregate_root]</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implements a newtype to use the <a href="../eventually/aggregate/struct.Root.html" title="struct eventually::aggregate::Root"><code>eventually::aggregate::Root</code></a> instance with
1+
<!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="Implements a newtype to use the `eventually::aggregate::Root` instance with user-defined `eventually::aggregate::Aggregate` types."><title>aggregate_root in eventually_macros - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-46132b98.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="eventually_macros" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.1 (4eb161250 2025-03-15)" data-channel="1.85.1" data-search-js="search-75f5ac3e.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc attr"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../eventually_macros/index.html">eventually_<wbr>macros</a><span class="version">0.1.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">aggregate_<wbr>root</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#context" title="Context">Context</a></li><li><a href="#panics" title="Panics">Panics</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate eventually_<wbr>macros</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">eventually_macros</a></span><h1>Attribute Macro <span class="attr">aggregate_root</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/eventually_macros/lib.rs.html#34-79">Source</a> </span></div><pre class="rust item-decl"><code>#[aggregate_root]</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implements a newtype to use the <a href="../eventually/aggregate/struct.Root.html" title="struct eventually::aggregate::Root"><code>eventually::aggregate::Root</code></a> instance with
22
user-defined <a href="../eventually/aggregate/trait.Aggregate.html" title="trait eventually::aggregate::Aggregate"><code>eventually::aggregate::Aggregate</code></a> types.</p>
33
<h2 id="context"><a class="doc-anchor" href="#context">§</a>Context</h2>
44
<p>The eventually API uses <a href="../eventually/aggregate/struct.Root.html" title="struct eventually::aggregate::Root"><code>aggregate::Root</code></a>
@@ -8,7 +8,7 @@ <h2 id="context"><a class="doc-anchor" href="#context">§</a>Context</h2>
88
<p>However, it’s not possible to use <code>impl aggregate::Root&lt;MyAggregateType&gt;</code> (<code>MyAggregateType</code>
99
being an example of user-defined <code>Aggregate</code> type) outside the <code>eventually</code> crate (E0116).
1010
Therefore, a newtype that uses <code>aggregate::Root&lt;T&gt;</code> is required.</p>
11-
<p>This attribute macro makes the implementation of a newtype easy, as it Implements
11+
<p>This attribute macro makes the implementation of a newtype easy, as it implements
1212
conversion traits from and to <code>aggregate::Root&lt;T&gt;</code> and implements automatic deref
1313
through <a href="https://doc.rust-lang.org/1.85.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref"><code>std::ops::Deref</code></a> and <a href="https://doc.rust-lang.org/1.85.1/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut"><code>std::ops::DerefMut</code></a>.</p>
1414
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>

eventually_macros/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!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="`eventually-macros` contains useful macros that provides different implementations of traits and functionalities from eventually."><title>eventually_macros - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-46132b98.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="eventually_macros" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.1 (4eb161250 2025-03-15)" data-channel="1.85.1" data-search-js="search-75f5ac3e.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../eventually_macros/index.html">eventually_<wbr>macros</a><span class="version">0.1.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 id="rustdoc-toc"><h3><a href="#attributes">Crate Items</a></h3><ul class="block"><li><a href="#attributes" title="Attribute Macros">Attribute Macros</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>eventually_macros</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/eventually_macros/lib.rs.html#1-83">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><code>eventually-macros</code> contains useful macros that provides
1+
<!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="`eventually-macros` contains useful macros that provides different implementations of traits and functionalities from eventually."><title>eventually_macros - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-46132b98.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="eventually_macros" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.1 (4eb161250 2025-03-15)" data-channel="1.85.1" data-search-js="search-75f5ac3e.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../eventually_macros/index.html">eventually_<wbr>macros</a><span class="version">0.1.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 id="rustdoc-toc"><h3><a href="#attributes">Crate Items</a></h3><ul class="block"><li><a href="#attributes" title="Attribute Macros">Attribute Macros</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>eventually_macros</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/eventually_macros/lib.rs.html#1-79">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><code>eventually-macros</code> contains useful macros that provides
22
different implementations of traits and functionalities from <a href="../eventually/index.html" title="mod eventually">eventually</a>.</p>
33
</div></details><h2 id="attributes" class="section-header">Attribute Macros<a href="#attributes" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="attr" href="attr.aggregate_root.html" title="attr eventually_macros::aggregate_root">aggregate_<wbr>root</a></div><div class="desc docblock-short">Implements a newtype to use the <a href="../eventually/aggregate/struct.Root.html" title="struct eventually::aggregate::Root"><code>eventually::aggregate::Root</code></a> instance with
44
user-defined <a href="../eventually/aggregate/trait.Aggregate.html" title="trait eventually::aggregate::Aggregate"><code>eventually::aggregate::Aggregate</code></a> types.</div></li></ul></section></div></main></body></html>

src/bank_accounting/domain.rs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@
413413

414414
<span class="kw">fn </span>apply(state: <span class="prelude-ty">Option</span>&lt;<span class="self">Self</span>&gt;, event: <span class="self">Self</span>::Event) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, <span class="self">Self</span>::Error&gt; {
415415
<span class="kw">match </span>state {
416-
<span class="prelude-val">None </span>=&gt; <span class="kw">match </span>event {
416+
Option::None =&gt; <span class="kw">match </span>event {
417417
BankAccountEvent::WasOpened {
418418
id,
419419
initial_balance,

src/eventually_macros/lib.rs.html

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,16 @@
7777
<a href="#76" id="76">76</a>
7878
<a href="#77" id="77">77</a>
7979
<a href="#78" id="78">78</a>
80-
<a href="#79" id="79">79</a>
81-
<a href="#80" id="80">80</a>
82-
<a href="#81" id="81">81</a>
83-
<a href="#82" id="82">82</a>
84-
<a href="#83" id="83">83</a></pre></div><pre class="rust"><code><span class="doccomment">//! `eventually-macros` contains useful macros that provides
80+
<a href="#79" id="79">79</a></pre></div><pre class="rust"><code><span class="doccomment">//! `eventually-macros` contains useful macros that provides
8581
//! different implementations of traits and functionalities from [eventually].
8682

8783
</span><span class="attr">#![deny(unsafe_code, unused_qualifications, trivial_casts, missing_docs)]
8884
#![deny(clippy::all, clippy::pedantic, clippy::cargo)]
8985

9086
</span><span class="kw">use </span>proc_macro::TokenStream;
9187
<span class="kw">use </span>quote::quote;
92-
<span class="kw">use </span>syn::{parse_macro_input, AttributeArgs, Fields, ItemStruct, Meta, NestedMeta, Path};
88+
<span class="kw">use </span>syn::punctuated::Punctuated;
89+
<span class="kw">use </span>syn::{parse_macro_input, Fields, ItemStruct, Token, Type};
9390

9491
<span class="doccomment">/// Implements a newtype to use the [`eventually::aggregate::Root`] instance with
9592
/// user-defined [`eventually::aggregate::Aggregate`] types.
@@ -105,7 +102,7 @@
105102
/// being an example of user-defined `Aggregate` type) outside the `eventually` crate (E0116).
106103
/// Therefore, a newtype that uses `aggregate::Root&lt;T&gt;` is required.
107104
///
108-
/// This attribute macro makes the implementation of a newtype easy, as it Implements
105+
/// This attribute macro makes the implementation of a newtype easy, as it implements
109106
/// conversion traits from and to `aggregate::Root&lt;T&gt;` and implements automatic deref
110107
/// through [`std::ops::Deref`] and [`std::ops::DerefMut`].
111108
///
@@ -114,19 +111,14 @@
114111
/// This method will panic if the Aggregate Root type is not provided as a macro parameter.
115112
</span><span class="attr">#[proc_macro_attribute]
116113
</span><span class="kw">pub fn </span>aggregate_root(args: TokenStream, item: TokenStream) -&gt; TokenStream {
117-
<span class="kw">let </span>args = <span class="macro">parse_macro_input!</span>(args <span class="kw">as </span>AttributeArgs);
118114
<span class="kw">let </span><span class="kw-2">mut </span>item = <span class="macro">parse_macro_input!</span>(item <span class="kw">as </span>ItemStruct);
119115
<span class="kw">let </span>item_ident = item.ident.clone();
120116

121-
<span class="kw">let </span>aggregate_type = args
122-
.first()
123-
.and_then(|meta| <span class="kw">match </span>meta {
124-
NestedMeta::Meta(Meta::Path(Path { segments, .. })) =&gt; <span class="prelude-val">Some</span>(segments),
125-
<span class="kw">_ </span>=&gt; <span class="prelude-val">None</span>,
126-
})
127-
.and_then(|segments| segments.first())
128-
.map(|segment| segment.ident.clone())
129-
.expect(<span class="string">"the aggregate root type must be provided as macro parameter"</span>);
117+
<span class="kw">let </span>aggregate_type: Type =
118+
<span class="macro">parse_macro_input!</span>(args with Punctuated::&lt;Type, <span class="macro">Token!</span>[,]&gt;::parse_terminated)
119+
.into_iter()
120+
.next()
121+
.expect(<span class="string">"the aggregate root type must be provided as macro parameter"</span>);
130122

131123
item.fields = Fields::Unnamed(
132124
syn::parse2(<span class="macro">quote!</span> { (eventually::aggregate::Root&lt;#aggregate_type&gt;) }).unwrap(),

0 commit comments

Comments
 (0)