Rust packaging: Difference between revisions

From wikinotes
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:
= Project Dependencies =
= Project Dependencies =
<blockquote>
<blockquote>
== Add Dependency ==
For full details, see [[rust cargo]].
<blockquote>


</blockquote><!-- Add Dependency -->
Add a dependency, change version-request, remove package
<syntaxhighlight lang="toml">
# ${project}/Cargo.toml


== Update Dependency ==
# ...
<blockquote>


</blockquote><!-- Update Dependency -->
[dependencies]
rand = "0.8.5"
</syntaxhighlight>


== Remove Dependency ==
Then Build
<blockquote>
<syntaxhighlight lang="bash">
cargo build
</syntaxhighlight>


</blockquote><!-- Remove Dependency -->
Done.
</blockquote><!-- Project Dependencies -->
</blockquote><!-- Project Dependencies -->
= OS Package Management =
<blockquote>
See https://doc.rust-lang.org/cargo/commands/cargo-install.html
<syntaxhighlight lang="bash">
cargo install my_crate
cargo install my_crate@1.1.1
cargo install --path /path/to/crate
</syntaxhighlight>
</blockquote><!-- Package Management -->

Latest revision as of 21:40, 9 February 2023

Rust primarily uses rust cargo for packaging.
These packages are referred to as crates.

Project Dependencies

For full details, see rust cargo.

Add a dependency, change version-request, remove package

# ${project}/Cargo.toml

# ...

[dependencies]
rand = "0.8.5"

Then Build

cargo build

Done.

OS Package Management

See https://doc.rust-lang.org/cargo/commands/cargo-install.html

cargo install my_crate
cargo install my_crate@1.1.1
cargo install --path /path/to/crate