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§

UnsupportedPlatformError
The error type returned on unsupported platforms.
XAttrs
An iterator over a set of extended attributes names.

Constants§

SUPPORTED_PLATFORM
A constant indicating whether or not the target platform is supported.

Traits§

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

Functions§

get
Get an extended attribute for the specified file.
get_deref
Get an extended attribute for the specified file (dereference symlinks).
list
List extended attributes attached to the specified file.
list_deref
List extended attributes attached to the specified file (dereference symlinks).
remove
Remove an extended attribute from the specified file.
remove_deref
Remove an extended attribute from the specified file (dereference symlinks).
set
Set an extended attribute on the specified file.
set_deref
Set an extended attribute on the specified file (dereference symlinks).