diff --git a/runtime/permissions/lib.rs b/runtime/permissions/lib.rs index 8d96005b77cd1c..7d87f62b1ccb9d 100644 --- a/runtime/permissions/lib.rs +++ b/runtime/permissions/lib.rs @@ -1114,33 +1114,33 @@ impl ImportDescriptor { pub struct EnvDescriptorParseError; #[derive(Clone, Eq, PartialEq, Hash, Debug)] -enum EnvQueryDescriptorInner { +pub enum EnvDescriptor { Name(EnvVarName), PrefixPattern(EnvVarName), } -#[derive(Clone, Eq, PartialEq, Hash, Debug)] -pub struct EnvQueryDescriptor(EnvQueryDescriptorInner); - -impl EnvQueryDescriptor { +impl EnvDescriptor { pub fn new(env: impl AsRef) -> Self { - Self(EnvQueryDescriptorInner::Name(EnvVarName::new(env))) + if let Some(prefix_pattern) = env.as_ref().strip_suffix('*') { + Self::PrefixPattern(EnvVarName::new(prefix_pattern)) + } else { + Self::Name(EnvVarName::new(env)) + } } } #[derive(Clone, Eq, PartialEq, Hash, Debug)] -pub enum EnvDescriptor { +enum EnvQueryDescriptorInner { Name(EnvVarName), PrefixPattern(EnvVarName), } -impl EnvDescriptor { +#[derive(Clone, Eq, PartialEq, Hash, Debug)] +pub struct EnvQueryDescriptor(EnvQueryDescriptorInner); + +impl EnvQueryDescriptor { pub fn new(env: impl AsRef) -> Self { - if let Some(prefix_pattern) = env.as_ref().strip_suffix('*') { - Self::PrefixPattern(EnvVarName::new(prefix_pattern)) - } else { - Self::Name(EnvVarName::new(env)) - } + Self(EnvQueryDescriptorInner::Name(EnvVarName::new(env))) } }