pub struct PermissionsSection {
pub fs_read: Option<bool>,
pub fs_write: Option<bool>,
pub net_connect: Option<bool>,
pub net_listen: Option<bool>,
pub process: Option<bool>,
pub env: Option<bool>,
pub time: Option<bool>,
pub random: Option<bool>,
pub fs: Option<FsPermissions>,
pub net: Option<NetPermissions>,
}Expand description
[permissions] section — declares what capabilities the project needs.
Missing fields default to true for backwards compatibility (unless
the --sandbox CLI flag overrides to PermissionSet::pure()).
Fields§
§fs_read: Option<bool>§fs_write: Option<bool>§net_connect: Option<bool>§net_listen: Option<bool>§process: Option<bool>§env: Option<bool>§time: Option<bool>§random: Option<bool>§fs: Option<FsPermissions>Scoped filesystem constraints.
net: Option<NetPermissions>Scoped network constraints.
Implementations§
Source§impl PermissionsSection
impl PermissionsSection
Sourcepub fn from_shorthand(name: &str) -> Option<Self>
pub fn from_shorthand(name: &str) -> Option<Self>
Create a section from a shorthand name.
"pure"— all permissions false (no I/O)."readonly"— fs.read + env + time, nothing else."full"— all permissions true.
Sourcepub fn to_permission_set(&self) -> PermissionSet
pub fn to_permission_set(&self) -> PermissionSet
Convert to a PermissionSet from shape-abi-v1.
Unset fields (None) default to true for backwards compatibility.
Sourcepub fn to_scope_constraints(&self) -> ScopeConstraints
pub fn to_scope_constraints(&self) -> ScopeConstraints
Build ScopeConstraints from the fs/net sub-sections.
Trait Implementations§
Source§impl Clone for PermissionsSection
impl Clone for PermissionsSection
Source§fn clone(&self) -> PermissionsSection
fn clone(&self) -> PermissionsSection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PermissionsSection
impl Debug for PermissionsSection
Source§impl Default for PermissionsSection
impl Default for PermissionsSection
Source§fn default() -> PermissionsSection
fn default() -> PermissionsSection
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PermissionsSection
impl<'de> Deserialize<'de> for PermissionsSection
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PermissionsSection
impl PartialEq for PermissionsSection
Source§impl Serialize for PermissionsSection
impl Serialize for PermissionsSection
impl StructuralPartialEq for PermissionsSection
Auto Trait Implementations§
impl Freeze for PermissionsSection
impl RefUnwindSafe for PermissionsSection
impl Send for PermissionsSection
impl Sync for PermissionsSection
impl Unpin for PermissionsSection
impl UnsafeUnpin for PermissionsSection
impl UnwindSafe for PermissionsSection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more