mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-04-05 11:20:55 +01:00
Ensures aliases don't contain characters which could cause issues. They are now also forbidden from being the same as an engine name to avoid issues.
35 lines
1,007 B
Rust
35 lines
1,007 B
Rust
use std::collections::BTreeMap;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::{
|
|
manifest::{Alias, DependencyType},
|
|
source::{wally::WallyPackageSource, DependencySpecifiers, PackageRef, PackageSources},
|
|
};
|
|
|
|
/// A Wally package reference
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
|
|
pub struct WallyPackageRef {
|
|
/// The index of the package
|
|
#[serde(
|
|
serialize_with = "crate::util::serialize_gix_url",
|
|
deserialize_with = "crate::util::deserialize_gix_url"
|
|
)]
|
|
pub index_url: gix::Url,
|
|
/// The dependencies of the package
|
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
|
pub dependencies: BTreeMap<Alias, (DependencySpecifiers, DependencyType)>,
|
|
}
|
|
impl PackageRef for WallyPackageRef {
|
|
fn dependencies(&self) -> &BTreeMap<Alias, (DependencySpecifiers, DependencyType)> {
|
|
&self.dependencies
|
|
}
|
|
|
|
fn use_new_structure(&self) -> bool {
|
|
false
|
|
}
|
|
|
|
fn source(&self) -> PackageSources {
|
|
PackageSources::Wally(WallyPackageSource::new(self.index_url.clone()))
|
|
}
|
|
}
|