pub struct Project {
pub project_id: String,
pub project_name: String,
pub version_groups: Vec<String>,
pub versions: Vec<String>,
}Expand description
A specific project info
Fields§
§project_id: StringProject id that given by Root, eg. “paper”
project_name: StringFull name / Display name of this project, eg. “Paper”
version_groups: Vec<String>(No desc)
versions: Vec<String>All downloadable versions, eg. “1.16.5”
Implementations§
Source§impl Project
impl Project
Sourcepub async fn new(project: &str) -> Result<Self>
pub async fn new(project: &str) -> Result<Self>
See Self::link
Sourcepub async fn get_version(&self, version: &str) -> Result<Version>
pub async fn get_version(&self, version: &str) -> Result<Version>
Return the given version’s info.
Examples found in repository?
examples/fetch_papermc.rs (line 19)
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(())
}Sourcepub async fn get_latest_version(&self) -> Result<Version>
pub async fn get_latest_version(&self) -> Result<Version>
Return the latest version’s info.
It is assumed that latest version is the last item in the list.
Examples found in repository?
examples/fetch_papermc.rs (line 13)
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 Project
impl<'de> Deserialize<'de> for Project
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 Project
impl RefUnwindSafe for Project
impl Send for Project
impl Sync for Project
impl Unpin for Project
impl UnwindSafe for Project
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