Skip to content

Commit

Permalink
Fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nadzyah committed Jan 31, 2024
1 parent 2a4fbf8 commit 17a41b9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
16 changes: 11 additions & 5 deletions client/hwlib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use rand::Rng;
mod models;
use models::devices;
use models::rbody::{
CertificationStatusResponse, CertifiedResponse, NotSeenResponse,
RelatedCertifiedSystemExistsResponse,
};
use models::software;
use models::rbody::{RelatedCertifiedSystemExistsResponse, CertifiedResponse, NotSeenResponse, CertificationStatusResponse};

fn get_certified_system_sample() -> CertifiedResponse{
fn get_certified_system_sample() -> CertifiedResponse {
let kernel_package = software::KernelPackageValidator {
name: "Linux".to_string(),
version: "5.4.0-42-generic".to_string(),
Expand Down Expand Up @@ -88,13 +91,16 @@ fn get_related_certified_system_exists_sample() -> RelatedCertifiedSystemExistsR
}
}


pub async fn get_certification_status(_url: &str) -> Result<CertificationStatusResponse, reqwest::Error> {
pub async fn get_certification_status(
_url: &str,
) -> Result<CertificationStatusResponse, reqwest::Error> {
let mut rng = rand::thread_rng();
let response_type = rng.gen_range(0..3);
let response = match response_type {
0 => CertificationStatusResponse::Certified(get_certified_system_sample()),
1 => CertificationStatusResponse::RelatedCertifiedSystemExists(get_related_certified_system_exists_sample()),
1 => CertificationStatusResponse::RelatedCertifiedSystemExists(
get_related_certified_system_exists_sample(),
),
_ => CertificationStatusResponse::NotSeen(NotSeenResponse {
status: "Not Seen".to_string(),
}),
Expand Down
11 changes: 2 additions & 9 deletions client/hwlib/src/models/devices.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use serde::{Serialize, Deserialize};

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
pub struct AudioValidator {
pub model: String,
pub vendor: String,
}


#[derive(Serialize, Deserialize)]
pub struct BiosValidator {
pub firmware_revision: String,
Expand All @@ -17,15 +15,13 @@ pub struct BiosValidator {
pub version: String,
}


#[derive(Serialize, Deserialize)]
pub struct BoardValidator {
pub manufacturer: String,
pub product_name: String,
pub version: String
pub version: String,
}


#[derive(Serialize, Deserialize)]
pub struct ChassisValidator {
pub chassis_type: String,
Expand All @@ -43,7 +39,6 @@ pub struct GPUValidator {

#[derive(Serialize, Deserialize)]
pub struct NetworkAdapterValidator {

pub bus: String,
pub id: String,
pub model: String,
Expand Down Expand Up @@ -75,14 +70,12 @@ pub struct USBPeripheralValidator {

#[derive(Serialize, Deserialize)]
pub struct VideoCaptureValidator {

pub model: String,
pub vendor: String,
}

#[derive(Serialize, Deserialize)]
pub struct WirelessAdapterValidator {

pub model: String,
pub vendor: String,
}
2 changes: 1 addition & 1 deletion client/hwlib/src/models/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod devices;
pub mod software;
pub mod rbody;
pub mod software;
2 changes: 1 addition & 1 deletion client/hwlib/src/models/rbody.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};

use crate::models::devices;
use crate::models::software;
Expand Down
2 changes: 1 addition & 1 deletion client/hwlib/src/models/software.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct KernelPackageValidator {
Expand Down

0 comments on commit 17a41b9

Please sign in to comment.