Rust anatomy: Difference between revisions

From wikinotes
No edit summary
Line 1: Line 1:


= Project Components =
<blockquote>
A rust project comprises of
A rust project comprises of


Line 13: Line 16:
|}
|}


<syntaxhighlight lang="yaml">
package:
    - crate:
    - crate:
        - module:
        - module:
            - path
            - path
</syntaxhighlight>
= Components =
<blockquote>
== Packages ==
== Packages ==
<blockquote>
<blockquote>
Line 40: Line 31:


</blockquote><!-- Crates -->
</blockquote><!-- Crates -->
</blockquote><!-- Components -->
</blockquote><!-- Project Components -->

Revision as of 22:41, 7 February 2023


Project Components

A rust project comprises of

packages build/test/share a collection of crates
crates tree of modules that build a single library, or executable
modules organize scope/privacy of paths
paths files ?

Packages

A package is a collection of crates.

  • it may have multiple executable crates
  • it may only have one library crate

Crates

A crate can be either

  • a library (has src/lib.rs entrypoint)
  • an executable (has src/main.rs entrypoint)