## Module registry

Source
Expand description

Interact with the `TestRegistry`

## §Example

    use cargo_test_support::registry::Package;
    use cargo_test_support::project;
    use cargo_test_support::str;

    // Publish package "a" depending on "b".
    Package::new("a", "1.0.0")
        .dep("b", "1.0.0")
        .file("src/lib.rs", r#"
            extern crate b;
            pub fn f() -> i32 { b::f() * 2 }
        "#)
        .publish();

    // Publish package "b".
    Package::new("b", "1.0.0")
        .file("src/lib.rs", r#"
            pub fn f() -> i32 { 12 }
        "#)
        .publish();

    // Create a project that uses package "a".
    let p = project()
        .file("Cargo.toml", r#"
            [package]
            name = "foo"
            version = "0.0.1"

            [dependencies]
            a = "1.0"
        "#)
        .file("src/main.rs", r#"
            extern crate a;
            fn main() { println!("{}", a::f()); }
        "#)
        .build();

    // p.cargo("run").with_stdout_data(str!["24"]).run();

## Structs§

Dependency
  Published package dependency builder, see `Package::add_dep`
HttpServer
HttpServerHandle
Mutation 🔒
  A helper struct that collects the arguments for `HttpServer::check_authorized`. Based on looking at the request, these are the fields that the authentication header should attest to.
Package
  Published package builder for `TestRegistry`
PackageFile 🔒
  A file to be created in a package.
RegistryBuilder
  Prepare a local `TestRegistry` fixture
Request
  Request to the test http server
Response
  Response from the test http server
TestRegistry
  A local registry fixture

## Enums§

EntryData 🔒
  Entry with data that corresponds to `tar::EntryType`.
Token
  Auth-token for publishing, see `RegistryBuilder::token`

## Constants§

DEFAULT_MODE 🔒

## Functions§

alt_api_path
  Path to the alternative-registry version of `api_path`
alt_dl_path
  Path to the alternative-registry version of `dl_path`
alt_init
  Setup a local “alternative” `TestRegistry`
alt_registry_path
  Path to the alternative-registry version of `registry_path`
alt_registry_url 🔒
  URL to the alternative-registry version of `registry_url`
api_path
  Path to the local web API uploads
cksum
  Generate a checksum
dl_path
  Path to download `.crate` files using the web API endpoint.
generate_path 🔒
generate_url 🔒
init
  Setup a local pseudo-crates.io `TestRegistry`
registry_path
  Path to the local index for pseudo-crates.io.
save_new_crate 🔒

## Type Aliases§

FeatureMap 🔒
RequestCallback 🔒