Mode
Unix st_mode bits: permissions, the set-user-ID/set-group-ID/sticky bits,
and the file type.
Example
Reading a file's mode and applying it elsewhere:
let Metadata(info) = fs.metadata "template.sh"
let mode = info.mode
update_metadata "script.sh" mode: $mode
Inherits from: Iterable[ModeBit]
Constructor
Mode ...flags -> Mode overload 1 of 2
Constructs a flag set from symbols.
Parameters
| Name | Type | Description |
|---|---|---|
...flags |
ModeBit |
Mode flags -> Mode overload 2 of 2
Constructs a flag set from one iterable of symbols.
Parameters
| Name | Type | Description |
|---|---|---|
flags |
Iterable[ModeBit] |
Class Methods
from_int value -> Mode
Constructs a mode from a raw st_mode value, preserving unknown bits.
Parameters
| Name | Type | Description |
|---|---|---|
value |
Int |
Raw mode bits. |
Example
Fields
group @ security.unix.Permission[get]Group permissions.
int @ Int[get]The raw
st_modevalue, including the file type bits.Mask with
0o7777for the permission bits alone.other @ security.unix.Permission[get]Permissions for everyone else.
owner @ security.unix.Permission[get]Owner permissions.
Methods
(band)[S @ Mode] other -> S
Returns the flags set in both.
Parameters
| Name | Type | Description |
|---|---|---|
self |
S |
Receiver. |
other |
S |
(bnot)[S @ Mode]() -> S
Returns the flags of the type that are not set.
Parameters
| Name | Type | Description |
|---|---|---|
self |
S |
Receiver. |
(bor)[S @ Mode] other -> S
Returns the flags set in either.
Parameters
| Name | Type | Description |
|---|---|---|
self |
S |
Receiver. |
other |
S |
(bxor)[S @ Mode] other -> S
Returns the flags set in exactly one.
Parameters
| Name | Type | Description |
|---|---|---|
self |
S |
Receiver. |
other |
S |
contains flag -> Bool
Tests whether all flags named by flag are set.
Parameters
| Name | Type | Description |
|---|---|---|
flag |
ModeBit |