# Trait std::os::unix::fs::PermissionsExt 1.1.0 [−] [src]

    pub trait PermissionsExt {
        fn mode(&self) -> u32;
        fn set_mode(&mut self, mode: u32);
        fn from_mode(mode: u32) -> Self;
    }

Unix-specific extensions to `Permissions`

## Required Methods

### `fn mode(&self) -> u32`

Returns the underlying raw `mode_t` bits that are the standard Unix permissions for this file.

# Examples

    use std::fs::File;
    use std::os::unix::fs::PermissionsExt;

    let f = File::create("foo.txt")?;
    let metadata = f.metadata()?;
    let permissions = metadata.permissions();

    println!("permissions: {}", permissions.mode());Run

### `fn set_mode(&mut self, mode: u32)`

Sets the underlying raw bits for this set of permissions.

# Examples

    use std::fs::File;
    use std::os::unix::fs::PermissionsExt;

    let f = File::create("foo.txt")?;
    let metadata = f.metadata()?;
    let mut permissions = metadata.permissions();

    permissions.set_mode(0o644); // Read/write for owner and read for others.
    assert_eq!(permissions.mode(), 0o644);Run

### `fn from_mode(mode: u32) -> Self`

Creates a new instance of `Permissions` from the given set of Unix permission bits.

# Examples

    use std::fs::Permissions;
    use std::os::unix::fs::PermissionsExt;

    // Read/write for owner and read for others.
    let permissions = Permissions::from_mode(0o644);
    assert_eq!(permissions.mode(), 0o644);Run

## Implementors

- `impl PermissionsExt for Permissions`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)