I develop some GUI project and thoughts to separate one feature to the library, then publish it on crates as the separated product.
In PHP, I've work directly, inside the vendor directory, then copied files to the library project manually, on ready and tested
But with Rust compiler, not sure how can I make changes directly on live project in development, before commit or publish new release then download it through cargo.
Maybe I can work with initial release somewhere in target dir? How do you work with libraries on-the-fly?
If you're modifying a library which is already in crates.io, perhaps preparing the next version and testing it in some programs using it, you can add a patch section:
Bonus: when it's ready you just have to comment out the line in the patch section. This helps not losing version or features information in the dependencies part.
Variant with patch looks useful, just interesting how to ignore it for production environment because it works like internal / local fork and replaces original dependency.
Note: The [patch] table can also be specified as a configuration option, such as in a .cargo/config.toml file or a CLI option like --config 'patch.crates-io.rand.path="rand"'. This can be useful for local-only changes that you donβt want to commit, or temporarily testing a patch.
The .cargo/config.toml solution looks dangerous when testing with a library you're locally developing: what are the odds you'll test then forget your Cargo.toml doesn't represent what you tested and you'll commit ? If you modify the Cargo.toml file directly, this can't happen.
The normal practice for parallel developed dependencies of crates published to crates.io is to specify both the version and the local path: when you publish cargo strips out the local path and uses the version (or git repository etc)
It's not clear that it matters for applications that aren't published: you generally want whatever code you were locally developing against, even if they aren't published.