pub fn add(cfg: &Config, spec: AddSpec) -> Result<AddReport, PkgError>Expand description
Insert (or replace) a [deps.<name>] entry in the manifest.
Performs no network I/O and never invokes the fetcher; callers run
install afterwards. If the manifest file does not exist yet a
minimal [package] block is synthesised, using the manifest directory’s
name as the package name.
The manifest is rewritten through toml::to_string, so comments and
formatting of an existing file are not preserved (this matches the
CLI’s historical behaviour; update is the format-preserving path).
§Errors
PkgError::Validationwhen more than one oftag/rev/branchis set.PkgError::ManifestParse/PkgError::Iofor an unreadable existing manifest.PkgError::ManifestSerialize/PkgError::Ioon write.