mirror of
https://github.com/mbilker/vgpu_unlock-rs.git
synced 2026-01-17 11:57:00 +01:00
lib: print config at startup
This commit is contained in:
@@ -20,7 +20,7 @@ impl Defaults {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Config {
|
||||
#[serde(default = "Defaults::unlock")]
|
||||
pub unlock: bool,
|
||||
@@ -30,7 +30,7 @@ pub struct Config {
|
||||
pub pci_info_map: Option<HashMap<U32, PciInfoMapEntry>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct PciInfoMapEntry {
|
||||
pub device_id: u16,
|
||||
pub sub_system_id: u16,
|
||||
|
||||
@@ -76,7 +76,11 @@ static LAST_MDEV_UUID: Mutex<Option<Uuid>> = parking_lot::const_mutex(None);
|
||||
static CONFIG: Config = {
|
||||
match fs::read_to_string(DEFAULT_CONFIG_PATH) {
|
||||
Ok(config) => match toml::from_str::<Config>(&config) {
|
||||
Ok(config) => config,
|
||||
Ok(config) => {
|
||||
println!("{:?}", config);
|
||||
|
||||
config
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Failed to decode config: {}", e);
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ impl<'de> Deserialize<'de> for U32 {
|
||||
match u32::from_str_radix(v, radix) {
|
||||
Ok(n) => Ok(Self(n)),
|
||||
Err(e) => Err(D::Error::custom(format!(
|
||||
"Failed to parse string as base-{radix} integer: {e}"
|
||||
"Failed to parse string as base-{} integer: {}",
|
||||
radix, e
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user