wasm_pkg_client/
release.rs

1use std::cmp::Ordering;
2
3use wasm_pkg_common::{digest::ContentDigest, package::Version};
4
5/// Package release details.
6///
7/// Returned by [`crate::Client::get_release`] and passed to
8/// [`crate::Client::stream_content`].
9#[derive(Clone, Debug)]
10pub struct Release {
11    pub version: Version,
12    pub content_digest: ContentDigest,
13}
14
15#[derive(Clone, Debug, Eq)]
16pub struct VersionInfo {
17    pub version: Version,
18    pub yanked: bool,
19}
20
21impl Ord for VersionInfo {
22    fn cmp(&self, other: &Self) -> Ordering {
23        self.version.cmp(&other.version)
24    }
25}
26
27impl PartialOrd for VersionInfo {
28    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
29        Some(self.cmp(other))
30    }
31}
32
33impl PartialEq for VersionInfo {
34    fn eq(&self, other: &Self) -> bool {
35        self.version == other.version
36    }
37}
38
39impl std::fmt::Display for VersionInfo {
40    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41        write!(f, "{version}", version = self.version)
42    }
43}