pub struct Version {
pub project_id: String,
pub project_name: String,
pub version: String,
pub builds: Vec<u16>,
}Expand description
A specific verison info
Fields§
§project_id: StringProject id that given by Root, eg. “paper”
project_name: StringFull name / Display name of this project, eg. “Paper”
version: StringVersion name, eg. “1.16.5”
builds: Vec<u16>All downloadable builds, eg. 250
Implementations§
Source§impl Version
impl Version
Sourcepub fn link(project: &str, version: &str) -> String
pub fn link(project: &str, version: &str) -> String
Get raw url link of a version, giving a project_id and a version number.
Sourcepub async fn get_latest_build(&self) -> Result<Build>
pub async fn get_latest_build(&self) -> Result<Build>
Return the latest build’s info.
Examples found in repository?
examples/fetch_papermc.rs (line 14)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
pub async fn main()-> Result<()>{
let download_path = "/tmp/target.jar";
let root = Root::new().await?;
let paper = root.get_project("paper").await?;
let latest_version= paper.get_latest_version().await?;
let app = latest_version.get_latest_build().await?;
app.download(download_path).await?;
assert!(app.checksum(download_path).await?);
let download_path_1165 = "/tmp/target-1165.jar";
let version_1165= paper.get_version("1.16.5").await?;
let app_1165= version_1165.get_latest_build().await?;
app_1165.download(download_path_1165).await?;
assert!(app_1165.checksum(download_path_1165).await?);
Ok(())
}Trait Implementations§
Source§impl<'de> Deserialize<'de> for Version
impl<'de> Deserialize<'de> for Version
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 Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
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