cargo-add-dynamic

Crates.iocargo-add-dynamic
lib.rscargo-add-dynamic
version0.1.2
sourcesrc
created_at2022-09-09 15:46:08.920733
updated_at2022-10-02 02:43:47.672053
description Cargo-add command to make dependencies into dylibs.
homepagehttps://github.com/rksm/cargo-add-dynamic
repositoryhttps://github.com/rksm/cargo-add-dynamic
max_upload_size
id661952
size33,863
Robert Krahn (rksm)

documentation

README

cargo add-dynamic

Crates.io

This cargo command allows to wrap dependencies as dylibs.

For why you might want this see Speeding up incremental Rust compilation with dylibs.

Installation

cargo install cargo-add-dynamic

Example

To add a new dependency as a dylib to the current project run for example

cargo add-dynamic polars --features csv-file,lazy,list,describe,rows,fmt,strings,temporal

This will create a sub-package polars-dynamic with the following content.

polars-dynamic/Cargo.toml

[package]
name = "polars-dynamic"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
polars = { version = "0.23.2", features = ["csv-file", "lazy", "list", "describe", "rows", "fmt", "strings", "temporal"] }

[lib]
crate-type = ["dylib"]

polars-dynamic/src/lib.rs

pub use polars::*;

And it will add polars = { version = "0.1.0", path = "polars-dynamic", package = "polars-dynamic" } to the dependencies of the current package.

Usage

add-dynamic 
Cargo command similar to `cargo add` that will add a dependency <DEP> as a dynamic library (dylib)
crate by creating a new sub-package whose only dependency is the specified <DEP> and whose
crate-type is ["dylib"].

USAGE:
    cargo-add-dynamic [OPTIONS] <DEP>

ARGS:
    <DEP>    

OPTIONS:
    -F, --features <FEATURES>...    Space or comma separated list of features to activate
    -h, --help                      Print help information
        --lib-dir <DIR>             Directory for the new sub-package. Defaults to <DEP>-dynamic
    -n, --name <NAME>               Name of the dynamic library, defaults to <DEP>-dynamic
        --no-default-features       Disable the default features
        --offline                   Run without accessing the network
        --optional                  Mark the dependency as optional. The package name will be
                                    exposed as feature of your crate.
    -p, --package <SPEC>            Package to modify
        --path <PATH>               Filesystem path to local crate to add
        --rename <NAME>             Rename the dependency
                                    Example uses:
                                    - Depending on multiple versions of a crate
                                    - Depend on crates with the same name from different registries
    -v, --verbose                   Additional (debug) logging.
Commit count: 14

cargo fmt