MachineCfg: Implementing Default trait
use std::net::Ipv4Addr;
use std::path::PathBuf;
+pub const DEFAULT_SUBNET_MASK: &str = "255.255.255.0";
+
pub struct MachineCfg {
pub root_blk_file: Option<PathBuf>,
pub host_ip: Option<Ipv4Addr>,
@@ -10,6 +12,17 @@ pub struct MachineCfg {
pub vsock_guest_cid: Option<u64>,
}
+impl Default for MachineCfg {
+ fn default() -> Self {
+ MachineCfg {
+ root_blk_file: None,
+ host_ip: None,
+ subnet_mask: DEFAULT_SUBNET_MASK.parse().unwrap(),
+ vsock_guest_cid: None,
+ }
+ }
+}
+
impl MachineCfg {
pub fn new(
root_blk_file: Option<PathBuf>,
