pub struct Build {
pub project_id: String,
pub project_name: String,
pub version: String,
pub build: u16,
pub time: String,
pub channel: String,
pub promoted: bool,
pub changes: Vec<BuildChange>,
pub downloads: Application,
}Expand description
Same as Version
Fields§
§project_id: String§project_name: String§version: String§build: u16§time: String§channel: String§promoted: bool§changes: Vec<BuildChange>§downloads: ApplicationImplementations§
Source§impl Build
impl Build
pub fn link(project: &str, version: &str, build: u16) -> String
pub async fn new(project: &str, version: &str, build: u16) -> Result<Self>
Sourcepub fn download_link(&self) -> String
pub fn download_link(&self) -> String
Get the direct download link of this build.
Sourcepub fn download_digest_sha256(&self) -> &str
pub fn download_digest_sha256(&self) -> &str
Get the remote file sha256 digest.
Sourcepub async fn download(&self, path: impl AsRef<Path>) -> Result<()>
pub async fn download(&self, path: impl AsRef<Path>) -> Result<()>
Download the file.
Examples found in repository?
examples/fetch_papermc.rs (line 15)
6pub async fn main()-> Result<()>{
7 let download_path = "/tmp/target.jar";
8
9 let root = Root::new().await?;
10
11 let paper = root.get_project("paper").await?;
12
13 let latest_version= paper.get_latest_version().await?;
14 let app = latest_version.get_latest_build().await?;
15 app.download(download_path).await?;
16 assert!(app.checksum(download_path).await?);
17
18 let download_path_1165 = "/tmp/target-1165.jar";
19 let version_1165= paper.get_version("1.16.5").await?;
20 let app_1165= version_1165.get_latest_build().await?;
21 app_1165.download(download_path_1165).await?;
22 assert!(app_1165.checksum(download_path_1165).await?);
23
24 Ok(())
25}Sourcepub async fn checksum(&self, path: impl AsRef<Path>) -> Result<bool>
pub async fn checksum(&self, path: impl AsRef<Path>) -> Result<bool>
Check file sum.
Examples found in repository?
examples/fetch_papermc.rs (line 16)
6pub async fn main()-> Result<()>{
7 let download_path = "/tmp/target.jar";
8
9 let root = Root::new().await?;
10
11 let paper = root.get_project("paper").await?;
12
13 let latest_version= paper.get_latest_version().await?;
14 let app = latest_version.get_latest_build().await?;
15 app.download(download_path).await?;
16 assert!(app.checksum(download_path).await?);
17
18 let download_path_1165 = "/tmp/target-1165.jar";
19 let version_1165= paper.get_version("1.16.5").await?;
20 let app_1165= version_1165.get_latest_build().await?;
21 app_1165.download(download_path_1165).await?;
22 assert!(app_1165.checksum(download_path_1165).await?);
23
24 Ok(())
25}Trait Implementations§
Source§impl<'de> Deserialize<'de> for Build
impl<'de> Deserialize<'de> for Build
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Build
impl RefUnwindSafe for Build
impl Send for Build
impl Sync for Build
impl Unpin for Build
impl UnwindSafe for Build
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more