# Module cargo::core::source

source ·
Expand description

Fundamental types and traits for sources of Cargo packages.

A source is a provider that contains source files and metadata of packages. It provides a number of methods to fetch those package informations, for example, querying metadata or downloading files for a package. These informations then can be used as dependencies for other Cargo packages.

Notably, this module contains

- `Source` trait as an abstraction of different sources
- `SourceMap` struct as a map of all available sources
- `SourceId` struct as an unique identifier for a certain source

For implementations of `Source` trait, see `crate::sources`.

## Modules

- source_id 🔒

## Structs

- SourceId
  Unique identifier for a source of packages.
- SourceMap
  A `HashMap` of `SourceId` to `Box<Source>`.

## Enums

- GitReference
  Information to find a specific commit in a Git repository.
- MaybePackage
  A download status that represents if a `Package` has already been downloaded, or if not then a location to download.
- QueryKind
  Defines how a dependency query will be performed for a `Source`.

## Traits

- Source
  An abstraction of different sources of Cargo packages.