Skip to content

Commit

Permalink
impls...
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlan404 committed May 29, 2024
1 parent 5b7bacb commit 795ba47
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ test/
# mkdocs output
site/

# mcman: Exclude mcman build outputs
**/server
# mcman: Exclude env secrets
.env
# mcman: Exclude exported mrpacks
Expand Down
3 changes: 3 additions & 0 deletions src/api/models/addon/addon.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
use anyhow::Result;
use serde::{Deserialize, Serialize};

use crate::api::models::{Environment, Step};

use super::AddonType;

#[derive(Debug, Deserialize, Serialize, Clone, Hash, PartialEq, Eq)]
pub enum AddonTarget {
Plugin,
Mod,
Custom(String),
}

#[derive(Debug, Deserialize, Serialize, Clone, Hash, PartialEq, Eq)]
pub struct Addon {
pub environment: Option<Environment>,
pub addon_type: AddonType,

Check warning on line 18 in src/api/models/addon/addon.rs

View workflow job for this annotation

GitHub Actions / clippy

field name starts with the struct's name

warning: field name starts with the struct's name --> src/api/models/addon/addon.rs:18:5 | 18 | pub addon_type: AddonType, | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#struct_field_names = note: `-W clippy::struct-field-names` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::struct_field_names)]`
Expand Down
12 changes: 12 additions & 0 deletions src/api/models/addon/addon_type.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Serialize, Clone, Hash, PartialEq, Eq)]
#[serde(tag = "type", rename_all = "lowercase")]
pub enum AddonType {
Url {
url: String,
},

#[serde(alias = "mr")]
Modrinth {
id: String,
version: String,
},
}
1 change: 1 addition & 0 deletions src/api/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod env;
pub mod addon;
pub mod packwiz;
pub mod mrpack;
pub mod unsup;
pub mod network;

pub use server::*;
Expand Down
9 changes: 9 additions & 0 deletions src/api/models/packwiz/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
mod packwiz_mod;
mod packwiz_pack;

use anyhow::Result;
pub use packwiz_pack::*;

Check warning on line 5 in src/api/models/packwiz/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

unused import: `packwiz_pack::*`

warning: unused import: `packwiz_pack::*` --> src/api/models/packwiz/mod.rs:5:9 | 5 | pub use packwiz_pack::*; | ^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
pub use packwiz_mod::*;

use super::Addon;

impl PackwizMod {
pub async fn into_addon(&self) -> Result<Addon> {

Check failure on line 11 in src/api/models/packwiz/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

methods called `into_*` usually take `self` by value

error: methods called `into_*` usually take `self` by value --> src/api/models/packwiz/mod.rs:11:29 | 11 | pub async fn into_addon(&self) -> Result<Addon> { | ^^^^^ | = help: consider choosing a less ambiguous name = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention = note: `-D clippy::wrong-self-convention` implied by `-D clippy::all` = help: to override `-D clippy::all` add `#[allow(clippy::wrong_self_convention)]`

Check warning on line 11 in src/api/models/packwiz/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

method `into_addon` is never used

warning: method `into_addon` is never used --> src/api/models/packwiz/mod.rs:11:18 | 10 | impl PackwizMod { | --------------- method in this implementation 11 | pub async fn into_addon(&self) -> Result<Addon> { | ^^^^^^^^^^
todo!()
}

Check warning on line 13 in src/api/models/packwiz/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

unused `async` for function with no await statements

warning: unused `async` for function with no await statements --> src/api/models/packwiz/mod.rs:11:5 | 11 | / pub async fn into_addon(&self) -> Result<Addon> { 12 | | todo!() 13 | | } | |_____^ | = help: consider removing the `async` from this function = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_async
}
File renamed without changes.
Empty file added src/api/models/unsup/mod.rs
Empty file.

0 comments on commit 795ba47

Please sign in to comment.