pub fn from_args(
        seccomp_level: Option<&String>,
        no_seccomp: bool,
        seccomp_filter: Option<&String>,
    ) -> Result<Self, FilterError> {
        // The argument parser is configured to forbid usages of `--seccomp-filter` or `--no-seccomp`
        // together with `--seccomp-level`, so we do not have to check for it.
        match seccomp_level {
            Some(value) => match &value[..] {
                "0" => Ok(SeccompConfig::None),
                "1" => Ok(SeccompConfig::Basic),
                "2" => Ok(SeccompConfig::Advanced),
                _ => Err(FilterError::SeccompConfig(
                    "Invalid value for --seccomp-level.".to_string(),
                )),
            },
            None => match no_seccomp {
                true => Ok(SeccompConfig::None),
                false => match seccomp_filter {
                    Some(path) => Ok(SeccompConfig::Custom(Box::new(
                        File::open(&path).map_err(FilterError::FileOpen)?,
                    ))),
                    None => Ok(SeccompConfig::Advanced),
                },
            },
        }
    }
/// Given the relevant command line args, return the appropriate config type.
Given the relevant command line args, return the appropriate config type.
Given the relevant command line args return the appropriate config type .
pub fn from_args(
        seccomp_level: Option<&String>,
        no_seccomp: bool,
        seccomp_filter: Option<&String>,
    ) -> Result<Self, FilterError> {
        // The argument parser is configured to forbid usages of `--seccomp-filter` or `--no-seccomp`
        // together with `--seccomp-level`, so we do not have to check for it.
        match seccomp_level {
            Some(value) => match &value[..] {
                "0" => Ok(SeccompConfig::None),
                "1" => Ok(SeccompConfig::Basic),
                "2" => Ok(SeccompConfig::Advanced),
                _ => Err(FilterError::SeccompConfig(
                    "Invalid value for --seccomp-level.".to_string(),
                )),
            },
            None => match no_seccomp {
                true => Ok(SeccompConfig::None),
                false => match seccomp_filter {
                    Some(path) => Ok(SeccompConfig::Custom(Box::new(
                        File::open(&path).map_err(FilterError::FileOpen)?,
                    ))),
                    None => Ok(SeccompConfig::Advanced),
                },
            },
        }
    }
pub fn from_args ( seccomp_level : Option < & String > , no_seccomp : bool , seccomp_filter : Option < & String > , ) -> Result < Self , FilterError > { // The argument parser is configured to forbid usages of `--seccomp-filter` or `--no-seccomp` // together with `--seccomp-level`, so we do not have to check for it. match seccomp_level { Some ( value ) => match & value [ .. ] { " " => Ok ( SeccompConfig :: None ) , " " => Ok ( SeccompConfig :: Basic ) , " " => Ok ( SeccompConfig :: Advanced ) , _ => Err ( FilterError :: SeccompConfig ( " " . to_string ( ) , ) ) , } , None => match no_seccomp { true => Ok ( SeccompConfig :: None ) , false => match seccomp_filter { Some ( path ) => Ok ( SeccompConfig :: Custom ( Box :: new ( File :: open ( & path ) . map_err ( FilterError :: FileOpen ) ? , ) ) ) , None => Ok ( SeccompConfig :: Advanced ) , } , } , } }
Given the relevant command line args, return the appropriate config type.
Given the relevant command line args return the appropriate config type .
seccomp_level
Option<&String>
no_seccomp
bool
seccomp_filter
Option<&String>
seccomp_level
Option<&String>
no_seccomp
bool
seccomp_filter
Option<&String>