17 releases (1 stable)

1.0.0 Nov 29, 2022
0.2.3 May 3, 2022
0.2.2 Jul 6, 2018
0.2.1 Jul 21, 2017
0.1.2 Jul 10, 2015

#37 in Filesystem

Download history 191703/week @ 2023-02-13 208895/week @ 2023-02-20 233831/week @ 2023-02-27 247380/week @ 2023-03-06 226347/week @ 2023-03-13 241074/week @ 2023-03-20 233145/week @ 2023-03-27 212582/week @ 2023-04-03 214016/week @ 2023-04-10 220599/week @ 2023-04-17 224090/week @ 2023-04-24 243174/week @ 2023-05-01 252340/week @ 2023-05-08 251437/week @ 2023-05-15 256414/week @ 2023-05-22 215073/week @ 2023-05-29

992,427 downloads per month
Used in 1,500 crates (33 directly)

MIT/Apache

27KB
732 lines

xattr

Build Status

A small library for setting, getting, and listing extended attributes.

Supported Platforms: Android, Linux, MacOS, FreeBSD, and NetBSD.

API Documentation: https://stebalien.github.com/xattr/xattr/

Unsupported Platforms

This library includes no-op support for unsupported platforms. That is, it will build on all platforms but always fail on unsupported platforms.

  1. You can turn this off by disabling the default unsupported feature. If you do so, this library will fail to compile on unsupported platforms.
  2. Alternatively, you can detect unsupported platforms at runtime by checking the xattr::SUPPORTED_PLATFORM boolean.

lib.rs:

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.

NOTE: In case of a symlink as path argument, all methods in this library work on the symlink itself without de-referencing it.

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);
}

Dependencies

~39KB