Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix style issues
Browse files Browse the repository at this point in the history
nadzyah committed Jan 31, 2024

Verified

This commit was signed with the committer’s verified signature.
nadzyah Nadzeya H
1 parent 2a4fbf8 commit ce14f1b
Showing 6 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion client/hwctl/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use hwlib::get_certification_status;
use std::env;
use std::process::exit;
use tokio;


#[tokio::main]
async fn main() {
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(),
@@ -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(),
}),
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,
@@ -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,
@@ -43,7 +39,6 @@ pub struct GPUValidator {

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

pub bus: String,
pub id: String,
pub model: String,
@@ -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;
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 {

0 comments on commit ce14f1b

Please sign in to comment.