@@ -93,8 +93,12 @@ pub type LocalPath = String;
9393///
9494/// (Should we normalize this one?)
9595pub type RelPath = String ;
96- /// The unique ID of an Artifact
97- pub type ArtifactId = String ;
96+
97+ declare_strongly_typed_string ! {
98+ /// The unique ID of an Artifact
99+ pub struct ArtifactId => & ArtifactIdRef ;
100+ }
101+
98102/// The unique ID of a System
99103pub type SystemId = String ;
100104/// The unique ID of an Asset
@@ -403,6 +407,19 @@ pub struct Release {
403407 pub hosting : Hosting ,
404408}
405409
410+ declare_strongly_typed_string ! {
411+ /// A lowercase descriptor for a checksum algorithm, like "sha256"
412+ /// or "blake2b".
413+ ///
414+ /// TODO(amos): Honestly this type should not exist, it's just what
415+ /// `ChecksumStyle` serializes to. `ChecksumsStyle` should just
416+ /// be serializable, that's it.
417+ pub struct ChecksumExtension => & ChecksumExtensionRef ;
418+
419+ /// A checksum value, usually the lower-cased hex string of the checksum
420+ pub struct ChecksumValue => & ChecksumValueRef ;
421+ }
422+
406423/// A distributable artifact that's part of a Release
407424///
408425/// i.e. a zip or installer
@@ -415,7 +432,7 @@ pub struct Artifact {
415432 /// indicate you can install the application with `cargo install` or `npm install`.
416433 #[ serde( skip_serializing_if = "Option::is_none" ) ]
417434 #[ serde( default ) ]
418- pub name : Option < String > ,
435+ pub name : Option < ArtifactId > ,
419436 /// The kind of artifact this is (e.g. "executable-zip")
420437 #[ serde( flatten) ]
421438 pub kind : ArtifactKind ,
@@ -442,14 +459,14 @@ pub struct Artifact {
442459 /// id of an Artifact that contains the checksum for this Artifact
443460 #[ serde( skip_serializing_if = "Option::is_none" ) ]
444461 #[ serde( default ) ]
445- pub checksum : Option < String > ,
462+ pub checksum : Option < ArtifactId > ,
446463 /// checksums for this artifact
447464 ///
448465 /// keys are the name of an algorithm like "sha256" or "sha512"
449466 /// values are the actual hex string of the checksum
450467 #[ serde( default ) ]
451468 #[ serde( skip_serializing_if = "BTreeMap::is_empty" ) ]
452- pub checksums : BTreeMap < String , String > ,
469+ pub checksums : BTreeMap < ChecksumExtension , ChecksumValue > ,
453470}
454471
455472/// An asset contained in an artifact (executable, license, etc.)
@@ -546,7 +563,7 @@ pub struct ExecutableAsset {
546563 /// The name of the Artifact containing symbols for this executable
547564 #[ serde( skip_serializing_if = "Option::is_none" ) ]
548565 #[ serde( default ) ]
549- pub symbols_artifact : Option < String > ,
566+ pub symbols_artifact : Option < ArtifactId > ,
550567}
551568
552569/// A C dynamic library artifact (so/dylib/dll)
@@ -555,7 +572,7 @@ pub struct DynamicLibraryAsset {
555572 /// The name of the Artifact containing symbols for this library
556573 #[ serde( skip_serializing_if = "Option::is_none" ) ]
557574 #[ serde( default ) ]
558- pub symbols_artifact : Option < String > ,
575+ pub symbols_artifact : Option < ArtifactId > ,
559576}
560577
561578/// A C static library artifact (a/lib)
@@ -564,7 +581,7 @@ pub struct StaticLibraryAsset {
564581 /// The name of the Artifact containing symbols for this library
565582 #[ serde( skip_serializing_if = "Option::is_none" ) ]
566583 #[ serde( default ) ]
567- pub symbols_artifact : Option < String > ,
584+ pub symbols_artifact : Option < ArtifactId > ,
568585}
569586
570587/// Info about a manifest version
@@ -612,7 +629,7 @@ impl Format {
612629
613630impl DistManifest {
614631 /// Create a new DistManifest
615- pub fn new ( releases : Vec < Release > , artifacts : BTreeMap < String , Artifact > ) -> Self {
632+ pub fn new ( releases : Vec < Release > , artifacts : BTreeMap < ArtifactId , Artifact > ) -> Self {
616633 Self {
617634 dist_version : None ,
618635 announcement_tag : None ,
@@ -655,7 +672,7 @@ impl DistManifest {
655672 pub fn artifacts_for_release < ' a > (
656673 & ' a self ,
657674 release : & ' a Release ,
658- ) -> impl Iterator < Item = ( & ' a str , & ' a Artifact ) > {
675+ ) -> impl Iterator < Item = ( & ' a ArtifactIdRef , & ' a Artifact ) > {
659676 release
660677 . artifacts
661678 . iter ( )
0 commit comments