<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Bishonen&#x27;s Blog - Architecture</title>
    <subtitle>Yet another software developemnt blog.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://bshn.rs/tags/architecture/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://bshn.rs"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2024-12-13T00:00:00+00:00</updated>
    <id>https://bshn.rs/tags/architecture/atom.xml</id>
    <entry xml:lang="en">
        <title>Rust Microservices - Project Structure</title>
        <published>2024-12-13T00:00:00+00:00</published>
        <updated>2024-12-13T00:00:00+00:00</updated>
        
        <author>
          <name>
            Nikita Bishonen
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://bshn.rs/blog/2024-12-13-rust-micro-structure/"/>
        <id>https://bshn.rs/blog/2024-12-13-rust-micro-structure/</id>
        
        <content type="html" xml:base="https://bshn.rs/blog/2024-12-13-rust-micro-structure/">&lt;p&gt;Hi! Today I’m sharing my thoughts on a convenient project structure for developing microservices in Rust. This is the first post in a potential “Rust Microservices” series. If I manage to finish it, I’ll compile it into a full book, so if you notice any inaccuracies or have your own thoughts on the topic - I’d be happy if you share them with me.&lt;&#x2F;p&gt;
&lt;p&gt;I’ll start this post with a brief overview. If you’re confident in your knowledge of Rust’s package and module system, feel free to jump to the &lt;a href=&quot;https:&#x2F;&#x2F;bshn.rs&#x2F;blog&#x2F;2024-12-13-rust-micro-structure&#x2F;#sovms&quot;&gt;core concept&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;packages-crates-and-modules-in-rust&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#packages-crates-and-modules-in-rust&quot; aria-label=&quot;Anchor link for: packages-crates-and-modules-in-rust&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
Packages, Crates, and Modules in Rust&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;If you’re not familiar with Rust, I recommend studying the original source - the chapter &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;book&#x2F;ch07-00-managing-growing-projects-with-packages-crates-and-modules.html&quot;&gt;Managing Growing Projects with Packages, Crates and Module&lt;&#x2F;a&gt; in the official Rust documentation. What follows is my interpretation, which may be inaccurate or incomplete.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;So, in Rust projects we have:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A Package containing:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Cargo(.toml | .lock)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;One or many crates, each having:
&lt;ul&gt;
&lt;li&gt;A crate root - &lt;code&gt;src&#x2F;(lib.rs | main.rs | bin&#x2F;*.rs)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Modules
&lt;ul&gt;
&lt;li&gt;inline - &lt;code&gt;mod _name_ { _body }&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;as separate files - &lt;code&gt;mod _name_;&lt;&#x2F;code&gt; + &lt;code&gt;src&#x2F;(_name_.rs | _name_&#x2F;mod.rs)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This creates a nesting doll or the tale of Koschei the Deathless - the needle (module) in an egg, the egg (crate) in a chicken, the chicken (package) in a chest (project).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;2024_12_13_rust_micro_structure_01.png&quot; alt=&quot;Packages in Rust&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Let’s examine the rules for accessing modules.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Modules can be private (hidden) and public.
&lt;ol&gt;
&lt;li&gt;By default, modules are private.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Entities inside a module can also be private and public.
&lt;ol&gt;
&lt;li&gt;By default, entities are private.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;And then interesting interactions and combinations begin, which I propose to examine with code examples.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#C6D0F5, #565869); background-color: light-dark(#303446, #FAFBFC);&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; children_private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; children_public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; grandchildren&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;            struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;            pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; neighbour&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Visually, the structure looks like this:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;2024_12_13_rust_micro_structure_02.png&quot; alt=&quot;Structure&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With this example, I want to show you the possible connections between modules and entities (in this example, we limit ourselves to empty structs).&lt;&#x2F;p&gt;
&lt;p&gt;Let’s break this down into several situations, which we’ll distinguish by the calling side.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#&quot; aria-label=&quot;Anchor link for: &quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
What Can a Parent Module Access?&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#C6D0F5, #565869); background-color: light-dark(#303446, #FAFBFC);&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; test_visibility&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; children_private::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;	children_private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; children_public::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;	children_public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; children_public::grandchildren::Private; &#x2F;&#x2F; Fails due to privacy of module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; children_public::grandchildren::Public; &#x2F;&#x2F; Fails due to privacy of module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Above, I show a test snippet for the parent module. As we can see, access is available to both (private and public) child modules, but only to public structs. Access to private “grandchildren” and their public structs is not available. Visually, this looks like:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;2024_12_13_rust_micro_structure_03.png&quot; alt=&quot;Parent&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;-1&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#-1&quot; aria-label=&quot;Anchor link for: -1&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
What Can a Child Module Access?&lt;&#x2F;h3&gt;
&lt;p&gt;For this, we’ll make an addition and add two structs to the parent module, analogous to the children.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#C6D0F5, #565869); background-color: light-dark(#303446, #FAFBFC);&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; Test visibility of super model and another sub-models of module one level above.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; test_visibility&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; super::children_private::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;children_private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; self::grandchildren::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#E78284, #2DAE58);&quot;&gt;    self&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;grandchildren&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;2024_12_13_rust_micro_structure_04.png&quot; alt=&quot;Child&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As we can see, our child’s tentacles reach quite far, and only private structs of sibling and child modules are inaccessible. However, private structs of the parent module are well within reach.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;-2&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#-2&quot; aria-label=&quot;Anchor link for: -2&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
What Can a Great-Grandchild Access?&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#C6D0F5, #565869); background-color: light-dark(#303446, #FAFBFC);&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; Test visibility of super model and another sub-models of module two levels above.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; test_visibility&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; super::super::children_private::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;children_private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;2024_12_13_rust_micro_structure_05.png&quot; alt=&quot;Great-grandchild&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For the great-grandchild, the situation is similar. I decided to show it for better understanding of how this multi-level mechanism works in Rust.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;-3&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#-3&quot; aria-label=&quot;Anchor link for: -3&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
What Can a Neighbor Access?&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;Unfortunately, I only noticed at this stage that all diagrams up to this point included the neighbor inside the parent module. In reality, it’s located alongside, not inside the parent. The diagram below contains the correct placement of this module.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#C6D0F5, #565869); background-color: light-dark(#303446, #FAFBFC);&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; Test visibilit of sub-modules inside another module on the same level.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; test_visibility&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	crate&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_private::Private; &#x2F;&#x2F; Fails due to privacy of module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_private::Public; &#x2F;&#x2F; Fails due to privacy of module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_public::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;	crate&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;children_public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_public::grandchildren::Private; &#x2F;&#x2F; Fails due to privacy of a module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_public::grandchildren::Public; &#x2F;&#x2F; Fails due to privacy of a module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;2024_12_13_rust_micro_structure_06.png&quot; alt=&quot;Neighbor&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The neighbor’s situation is quite boring - only public entities and paths to them are accessible. Note that the parent module is not public, yet the neighbor can still see it 👀&lt;&#x2F;p&gt;
&lt;h2 id=&quot;sovms&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#sovms&quot; aria-label=&quot;Anchor link for: sovms&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
SOVMS&lt;&#x2F;h2&gt;
&lt;p&gt;Or Structure Based on Visibility of Modules. The idea is that in Rust, we already have defined access rules (which I described in detail above) to module entities depending on their relationships (what relationship the calling module has to the called module).&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;I decided that the project structure should also be laid out based on these Rust language features to be more idiomatic. The idea is new, and as I test it, I’ll update this post.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;To get an idiomatic project structure, we should place modules based on who and what should see them. Is this part of the code used throughout the entire service? Move it as high as possible. Is another part of the code specific? Isolate it in a separate branch or hide it deeper.&lt;&#x2F;p&gt;
&lt;p&gt;The point is that modules shouldn’t be decomposed according to business domains (at least this shouldn’t be the basis of division). After all, in microservice architecture, these should be separate services (or separate Rust packages for monolithic applications). This way, we strive for the coveted golden ratio of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Larry_Constantine#Structured_design&quot;&gt;loose coupling and high cohesion&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;-4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#-4&quot; aria-label=&quot;Anchor link for: -4&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
TL;DR&lt;&#x2F;h3&gt;
&lt;p&gt;How do I see using this approach in writing microservices? Let me not waste more of your time reading my thoughts and show you a template:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#C6D0F5, #565869); background-color: light-dark(#303446, #FAFBFC);&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;! This is the base service crate. Better to make it a library, so functionality regarding how&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;! exactly to run it will be stored separately inside one main.rs or different bins.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; interfaces&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; graphql&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; http&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; grpc&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; api&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; config&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; resources&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; db&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; kafka&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; third_party_integration&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You can create a new package with two crates:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;main is responsible only for starting the application&lt;&#x2F;li&gt;
&lt;li&gt;lib stores the structure and is used in main, tests (integration), and additional “bins” if needed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;-5&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#-5&quot; aria-label=&quot;Anchor link for: -5&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
Real Example&lt;&#x2F;h3&gt;
&lt;p&gt;In this example, some names have been changed, but this is a real structure of one of several services. Writing them actually prompted me to derive some general theory regarding structuring microservices in Rust.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#C6D0F5, #565869); background-color: light-dark(#303446, #FAFBFC);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;src&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; bin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   └──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; events_processor.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; core&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; api.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; configuration.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   └──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; mod.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; interfaces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; graphql&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   │&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; mod.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   │&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; mutations.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   │&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; queries.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   │&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   └──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; subscriptions.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;   └──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; mod.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; lib.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; main.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;└──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; resources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;    ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; node_proxy.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;    ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; indexer_proxy.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;    ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; db.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;    ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; mod.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;    ├──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; reservoir_proxy.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;    └──&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt; real_time_data_ws.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;-6&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#-6&quot; aria-label=&quot;Anchor link for: -6&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
My Experience&lt;&#x2F;h3&gt;
&lt;p&gt;I can say that I find this structure convenient because it combines the advantages of the good old three-layer architectures and hexagonal architectures applicable to microservices. We divide our application into three branches:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;Resources&lt;&#x2F;code&gt; - everything that’s outside our service and where we’re consumers goes here. Databases, other services, message brokers (partially). Everything where we initiate communication and where we know more about the interlocutor than they know about us. (Previously I called this part &lt;code&gt;clients&lt;&#x2F;code&gt;, but the name resources seems more appropriate now). The main task of resources is to handle the specifics of interacting with these resources. Here we can have implementations of traits for encoding and decoding our data types for a specific database, and here we write “proxies” that transform schemas of other services into the one we operate with inside the service.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Interfaces&lt;&#x2F;code&gt; - everything that serves as entry points for requests to our service goes here. HTTP&#x2F;gRPC API, GraphQL, even message brokers if it’s part of processing incoming requests - everything goes here. Just like resources, here we try to isolate all specifics related to the particular mechanism of client-server interaction (that’s why I previously called this part &lt;code&gt;servers&lt;&#x2F;code&gt;). For example, all request deserializations and response serializations should be implemented here. After that, we should work with “clean” types.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Core&lt;&#x2F;code&gt; - this is the “cleanest” and “most important” place in our service. The main business logic is implemented here. Here we operate not with JSON that came over the network, but with its statically typed and verified representation. From the core, we can call resources, but ideally should know nothing about interfaces. However, we shouldn’t have access to low-level concepts of resources. Only to the public API.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;How does module placement help here? We see that all three branches are neighbors to each other, meaning they can only know public things, and specifics are safe to change (for example, changing the database or supporting REST alongside gRPC).&lt;&#x2F;p&gt;
&lt;p&gt;Inside branches, we go from general to specific and also separate independent parts into branches.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;graphql&lt;&#x2F;code&gt; consists of independent &lt;code&gt;queries&lt;&#x2F;code&gt;, &lt;code&gt;mutations&lt;&#x2F;code&gt;, &lt;code&gt;subscriptions&lt;&#x2F;code&gt;, but the common schema is in the root module:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#C6D0F5, #565869); background-color: light-dark(#303446, #FAFBFC);&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;! graphql&#x2F;mod.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; async&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; schema&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt; Result&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#99D1DB, #ADB1C2);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Schema&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#99D1DB, #ADB1C2);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Query&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt; Mutation&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt; Subscription&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#99D1DB, #ADB1C2);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#99D1DB, #ADB1C2);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; configuration&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt; Configuration&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;from_env&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; pool&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt; database&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;configuration&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #565869);&quot;&gt;database&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;await&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; producer&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt; kafka&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;build_producer&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;configuration&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #565869);&quot;&gt;kafka&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt;    Ok&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Schema&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;build&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Query&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt; Mutation&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt; Subscription&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;enable_federation&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;enable_subscription_in_federation&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each sub-module will call public “clean” methods from &lt;code&gt;core&#x2F;api.rs&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;api.rs&lt;&#x2F;code&gt; in my example contains common types in the root (both private and public), which its sub-modules &lt;code&gt;api::queries&lt;&#x2F;code&gt; and &lt;code&gt;api::commands&lt;&#x2F;code&gt; have full access to, but private types and implementations of the &lt;code&gt;api&lt;&#x2F;code&gt; module itself are inaccessible to anyone except its sub-modules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;-7&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#-7&quot; aria-label=&quot;Anchor link for: -7&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
Additional Materials&lt;&#x2F;h2&gt;
&lt;p&gt;If you’re interested in “playing” with the example from this article, here’s the full project code from the modules chapter:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#C6D0F5, #565869); background-color: light-dark(#303446, #FAFBFC);&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#E5C890, #ADB1C2);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt;!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt;allow&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt;clippy&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt;all&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; dead_code&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; path_statements&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; main&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt;    println!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #ADB1C2);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #CF9C00);&quot;&gt;Hello, modules privacy!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#A6D189, #ADB1C2);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; children_private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; children_public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; grandchildren&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;            struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;            pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);font-style: italic;&quot;&gt; Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;            &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; Test visibility of super model and another sub-models of module two levels above.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;            fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; test_visibility&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;                super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;                super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; super::super::children_private::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;                super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;children_private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;                super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;                super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; Test visibility of super model and another sub-models of module one level above.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; test_visibility&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; super::children_private::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;children_private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; self::grandchildren::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#E78284, #2DAE58);&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;grandchildren&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; Test visibility of sub-modules inside current module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; test_visibility&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; children_private::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;        children_private&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; children_public::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;        children_public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; children_public::grandchildren::Private; &#x2F;&#x2F; Fails due to privacy of module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; children_public::grandchildren::Public; &#x2F;&#x2F; Fails due to privacy of module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#EF9F76, #565869);&quot;&gt; neighbour&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; Test visibilit of sub-modules inside another module on the same level.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;    fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8CAAEE, #09A1ED);font-style: italic;&quot;&gt; test_visibility&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        crate&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_private::Private; &#x2F;&#x2F; Fails due to privacy of module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_private::Public; &#x2F;&#x2F; Fails due to privacy of module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_public::Private; &#x2F;&#x2F; Fails due to privacy of struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CA9EE6, #F767BB);&quot;&gt;        crate&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #565869);&quot;&gt;children_public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#81C8BE, #ADB1C2);&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E5C890, #13BBB7);font-style: italic;&quot;&gt;Public&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_public::grandchildren::Private; &#x2F;&#x2F; Fails due to privacy of a module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);font-style: italic;&quot;&gt; crate::parent::children_public::grandchildren::Public; &#x2F;&#x2F; Fails due to privacy of a module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#949CBB, #ADB1C2);&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
        
    </entry>
</feed>
