Rust anatomy: Difference between revisions

From wikinotes
No edit summary
Line 32: Line 32:
== Crates ==
== Crates ==
<blockquote>
<blockquote>
A crate can be either
* a library (has <code>src/lib.rs</code> entrypoint)
* an executable (has <code>src/main.rs</code> entrypoint)


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

Revision as of 22:40, 7 February 2023

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 ?
package:
    - crate:
    - crate:
        - module:
        - module:
            - path
            - path

Components

Packages

Crates

A crate can be either

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