pub fn add(
index_path: impl AsRef<Path>,
index_url: &str,
manifest_path: Option<&Path>,
upload: Option<&str>,
package_args: Option<&Vec<String>>
) -> Result<IndexPackage, Error>
Expand description
Add a new entry to the index.
The index_url
should be the public URL that users use to access the
index this package will be added to. The index_path
should be the
filesystem path to the index.
If the manifest_path
is not given, it will search the current directory
for the manifest.
This will call cargo package
to generate a .crate
file. The
package_args
will be given as-is to the cargo package
command. See
add_from_crate
for a variant of this function that takes a
pre-existing .crate
file.
upload
is an optional path to a directory to copy the .crate
file to
after it has been added to the index. It may contain {crate}
and
{version}
markers.
This only performs minimal validity checks on the crate. Callers should
consider adding more validation before calling. For example, placing
restrictions on the crate name format, checking dependencies with registry
set, limit category names, etc. See the crates.io code for examples
of the many checks it applies.