Crate xattr

source ·
Expand description

A pure-Rust library to manage extended attributes.

It provides support for manipulating extended attributes (xattrs) on modern Unix filesystems. See the attr(5) manpage for more details.

An extension trait FileExt is provided to directly work with standard File objects and file descriptors.

If the path argument is a symlink, the get/set/list/remove functions operate on the symlink itself. To operate on the symlink target, use the _deref variant of these functions.

let mut xattrs = xattr::list("/").unwrap().peekable();

if xattrs.peek().is_none() {
    println!("no xattr set on root");
    return;
}

println!("Extended attributes:");
for attr in xattrs {
    println!(" - {:?}", attr);
}

Structs

Constants

Traits

  • Extension trait to manipulate extended attributes on File-like objects.

Functions

  • Get an extended attribute for the specified file.
  • Get an extended attribute for the specified file (dereference symlinks).
  • List extended attributes attached to the specified file.
  • List extended attributes attached to the specified file (dereference symlinks).
  • Remove an extended attribute from the specified file.
  • Remove an extended attribute from the specified file (dereference symlinks).
  • Set an extended attribute on the specified file.
  • Set an extended attribute on the specified file (dereference symlinks).