self.query(dep, &mut |s| ret.push(s))?;
Ok(ret)
}
-
- /// Returns whether or not this registry will return summaries with
- /// checksums listed.
- fn supports_checksums(&self) -> bool;
-
- /// Returns whether or not this registry will return summaries with
- /// the `precise` field in the source id listed.
- fn requires_precise(&self) -> bool;
}
impl<'a, T: ?Sized + Registry + 'a> Registry for Box<T> {
fn query(&mut self, dep: &Dependency, f: &mut FnMut(Summary)) -> CargoResult<()> {
(**self).query(dep, f)
}
-
- fn supports_checksums(&self) -> bool {
- (**self).supports_checksums()
- }
-
- fn requires_precise(&self) -> bool {
- (**self).requires_precise()
- }
}
/// This structure represents a registry of known packages. It internally
f(self.lock(override_summary));
Ok(())
}
-
- fn supports_checksums(&self) -> bool {
- false
- }
-
- fn requires_precise(&self) -> bool {
- false
- }
}
fn lock(locked: &LockedMap, patches: &HashMap<Url, Vec<PackageId>>, summary: Summary) -> Summary {
Ok(())
}
}
-
- fn supports_checksums(&self) -> bool {
- false
- }
-
- fn requires_precise(&self) -> bool {
- false
- }
}
}
/// Returns the `SourceId` corresponding to this source
fn source_id(&self) -> &SourceId;
+ /// Returns whether or not this registry will return summaries with
+ /// checksums listed.
+ fn supports_checksums(&self) -> bool;
+
+ /// Returns whether or not this registry will return summaries with
+ /// the `precise` field in the source id listed.
+ fn requires_precise(&self) -> bool;
+
/// The update method performs any network operations required to
/// get the entire list of all names, versions and dependencies of
/// packages managed by the Source.
(**self).source_id()
}
+ /// Forwards to `Source::supports_checksums`
+ fn supports_checksums(&self) -> bool {
+ (**self).supports_checksums()
+ }
+
+ /// Forwards to `Source::requires_precise`
+ fn requires_precise(&self) -> bool {
+ (**self).requires_precise()
+ }
+
/// Forwards to `Source::update`
fn update(&mut self) -> CargoResult<()> {
(**self).update()
}
Ok(())
}
+}
+
+impl<'cfg> Source for DirectorySource<'cfg> {
+ fn source_id(&self) -> &SourceId {
+ &self.source_id
+ }
fn supports_checksums(&self) -> bool {
true
fn requires_precise(&self) -> bool {
true
}
-}
-
-impl<'cfg> Source for DirectorySource<'cfg> {
- fn source_id(&self) -> &SourceId {
- &self.source_id
- }
fn update(&mut self) -> CargoResult<()> {
self.packages.clear();
.expect("BUG: update() must be called before query()");
src.query(dep, f)
}
+}
+
+impl<'cfg> Source for GitSource<'cfg> {
+ fn source_id(&self) -> &SourceId {
+ &self.source_id
+ }
fn supports_checksums(&self) -> bool {
false
fn requires_precise(&self) -> bool {
true
}
-}
-
-impl<'cfg> Source for GitSource<'cfg> {
- fn source_id(&self) -> &SourceId {
- &self.source_id
- }
fn update(&mut self) -> CargoResult<()> {
let lock =
}
Ok(())
}
+}
+
+impl<'cfg> Source for PathSource<'cfg> {
+ fn source_id(&self) -> &SourceId {
+ &self.source_id
+ }
fn supports_checksums(&self) -> bool {
false
fn requires_precise(&self) -> bool {
false
}
-}
-
-impl<'cfg> Source for PathSource<'cfg> {
- fn source_id(&self) -> &SourceId {
- &self.source_id
- }
fn update(&mut self) -> CargoResult<()> {
if !self.updated {
self.index.query(dep, &mut *self.ops, f)
}
+}
+
+impl<'cfg> Source for RegistrySource<'cfg> {
+ fn source_id(&self) -> &SourceId {
+ &self.source_id
+ }
fn supports_checksums(&self) -> bool {
true
fn requires_precise(&self) -> bool {
false
}
-}
-
-impl<'cfg> Source for RegistrySource<'cfg> {
- fn source_id(&self) -> &SourceId {
- &self.source_id
- }
fn update(&mut self) -> CargoResult<()> {
// If we have an imprecise version then we don't know what we're going
.chain_err(|| format!("failed to query replaced source {}", self.to_replace))?;
Ok(())
}
+}
+
+impl<'cfg> Source for ReplacedSource<'cfg> {
+ fn source_id(&self) -> &SourceId {
+ &self.to_replace
+ }
fn supports_checksums(&self) -> bool {
self.inner.supports_checksums()
fn requires_precise(&self) -> bool {
self.inner.requires_precise()
}
-}
-
-impl<'cfg> Source for ReplacedSource<'cfg> {
- fn source_id(&self) -> &SourceId {
- &self.to_replace
- }
fn update(&mut self) -> CargoResult<()> {
self.inner
}
Ok(())
}
- fn supports_checksums(&self) -> bool {
- false
- }
- fn requires_precise(&self) -> bool {
- false
- }
}
let mut registry = MyRegistry(registry);
let summary = Summary::new(pkg.clone(), deps, BTreeMap::new(), None, false).unwrap();