runtime-rs: add the missing default trait

Some structs in the runtime-rs don't implement Default trait.
This commit adds the missing Default.

Fixes: #5463

Signed-off-by: Li Hongyu <lihongyu1999@bupt.edu.cn>
This commit is contained in:
Li Hongyu
2022-11-22 11:54:43 +00:00
parent 7566a7eae4
commit 844bf053b2
8 changed files with 59 additions and 40 deletions

View File

@@ -9,6 +9,8 @@ use std::convert::TryFrom;
use serde::{Deserialize, Serialize};
pub const DEFAULT_REMOVE_CONTAINER_REQUEST_TIMEOUT: u32 = 10;
#[derive(PartialEq, Clone, Default)]
pub struct Empty {}
@@ -164,7 +166,7 @@ impl ContainerProcessID {
}
}
#[derive(PartialEq, Clone, Debug, Default)]
#[derive(PartialEq, Clone, Debug)]
pub struct RemoveContainerRequest {
pub container_id: String,
pub timeout: u32,
@@ -179,6 +181,15 @@ impl RemoveContainerRequest {
}
}
impl std::default::Default for RemoveContainerRequest {
fn default() -> Self {
Self {
container_id: "".to_string(),
timeout: DEFAULT_REMOVE_CONTAINER_REQUEST_TIMEOUT,
}
}
}
#[derive(PartialEq, Clone, Default)]
pub struct SignalProcessRequest {
pub process_id: ContainerProcessID,