pub fn from_str(action: &str, val: Option<i32>) -> Result<Self> {
        match action {
            "SCMP_ACT_KILL_PROCESS" => Ok(Self::KillProcess),
            "SCMP_ACT_KILL_THREAD" => Ok(Self::KillThread),
            "SCMP_ACT_KILL" => Ok(Self::KillThread),
            "SCMP_ACT_TRAP" => Ok(Self::Trap),
            "SCMP_ACT_NOTIFY" => Ok(Self::Notify),
            "SCMP_ACT_ERRNO" => match val {
                Some(v) => Ok(Self::Errno(v)),
                None => Err(SeccompError::new(ParseError)),
            },
            "SCMP_ACT_TRACE" => match val {
                Some(v) => Ok(Self::Trace(v.try_into().map_err(
                    |e: std::num::TryFromIntError| SeccompError::new(Common(e.to_string())),
                )?)),
                None => Err(SeccompError::new(ParseError)),
            },
            "SCMP_ACT_LOG" => Ok(Self::Log),
            "SCMP_ACT_ALLOW" => Ok(Self::Allow),
            _ => Err(SeccompError::new(ParseError)),
        }
    }
/// Convert string seccomp action to ScmpAction
Convert string seccomp action to ScmpAction
Convert string seccomp action to ScmpAction
pub fn from_str(action: &str, val: Option<i32>) -> Result<Self> {
        match action {
            "SCMP_ACT_KILL_PROCESS" => Ok(Self::KillProcess),
            "SCMP_ACT_KILL_THREAD" => Ok(Self::KillThread),
            "SCMP_ACT_KILL" => Ok(Self::KillThread),
            "SCMP_ACT_TRAP" => Ok(Self::Trap),
            "SCMP_ACT_NOTIFY" => Ok(Self::Notify),
            "SCMP_ACT_ERRNO" => match val {
                Some(v) => Ok(Self::Errno(v)),
                None => Err(SeccompError::new(ParseError)),
            },
            "SCMP_ACT_TRACE" => match val {
                Some(v) => Ok(Self::Trace(v.try_into().map_err(
                    |e: std::num::TryFromIntError| SeccompError::new(Common(e.to_string())),
                )?)),
                None => Err(SeccompError::new(ParseError)),
            },
            "SCMP_ACT_LOG" => Ok(Self::Log),
            "SCMP_ACT_ALLOW" => Ok(Self::Allow),
            _ => Err(SeccompError::new(ParseError)),
        }
    }
pub fn from_str ( action : & str , val : Option < i32 > ) -> Result < Self > { match action { " " => Ok ( Self :: KillProcess ) , " " => Ok ( Self :: KillThread ) , " " => Ok ( Self :: KillThread ) , " " => Ok ( Self :: Trap ) , " " => Ok ( Self :: Notify ) , " " => match val { Some ( v ) => Ok ( Self :: Errno ( v ) ) , None => Err ( SeccompError :: new ( ParseError ) ) , } , " " => match val { Some ( v ) => Ok ( Self :: Trace ( v . try_into ( ) . map_err ( | e : std :: num :: TryFromIntError | SeccompError :: new ( Common ( e . to_string ( ) ) ) , ) ? ) ) , None => Err ( SeccompError :: new ( ParseError ) ) , } , " " => Ok ( Self :: Log ) , " " => Ok ( Self :: Allow ) , _ => Err ( SeccompError :: new ( ParseError ) ) , } }
Convert string seccomp action to ScmpAction
Convert string seccomp action to ScmpAction
action
&str
val
Option<i32>