This commit is contained in:
Dhghomon 2021-10-31 02:11:57 +00:00
parent 613ed5c0ac
commit f6ac75a189
4 changed files with 4 additions and 4 deletions

View File

@ -188,7 +188,7 @@ note: the function `prints_one_thing` is defined here
4 | fn prints_one_thing<T: Display>(input: T) { 4 | fn prints_one_thing<T: Display>(input: T) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
</code></pre> </code></pre>
<p>It's easy to understand that function <code>print_one_thing</code> is private. It also shows us with <code>src\main.rs:4:5</code> where to find the function. This is helpful because you can write <code>mod</code>s not just in one file, but over a lot of files as well.</p> <p>It's easy to understand that function <code>prints_one_thing</code> is private. It also shows us with <code>src\main.rs:4:5</code> where to find the function. This is helpful because you can write <code>mod</code>s not just in one file, but over a lot of files as well.</p>
<p>Now we just write <code>pub fn</code> instead of <code>fn</code> and everything works.</p> <p>Now we just write <code>pub fn</code> instead of <code>fn</code> and everything works.</p>
<pre><pre class="playground"><code class="language-rust">mod print_things { <pre><pre class="playground"><code class="language-rust">mod print_things {
use std::fmt::Display; use std::fmt::Display;

View File

@ -8707,7 +8707,7 @@ note: the function `prints_one_thing` is defined here
4 | fn prints_one_thing&lt;T: Display&gt;(input: T) { 4 | fn prints_one_thing&lt;T: Display&gt;(input: T) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
</code></pre> </code></pre>
<p>It's easy to understand that function <code>print_one_thing</code> is private. It also shows us with <code>src\main.rs:4:5</code> where to find the function. This is helpful because you can write <code>mod</code>s not just in one file, but over a lot of files as well.</p> <p>It's easy to understand that function <code>prints_one_thing</code> is private. It also shows us with <code>src\main.rs:4:5</code> where to find the function. This is helpful because you can write <code>mod</code>s not just in one file, but over a lot of files as well.</p>
<p>Now we just write <code>pub fn</code> instead of <code>fn</code> and everything works.</p> <p>Now we just write <code>pub fn</code> instead of <code>fn</code> and everything works.</p>
<pre><pre class="playground"><code class="language-rust">mod print_things { <pre><pre class="playground"><code class="language-rust">mod print_things {
use std::fmt::Display; use std::fmt::Display;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long