pub async fn get_xattr<T>(
path: impl AsRef<Path>,
name: impl AsRef<OsStr>,
buffer: T,
) -> BufResult<usize, T>where
T: IoBufMut,fs and (Android or Linux) only.Expand description
Reads an extended attribute from a path, following the final symbolic link.
This has getxattr semantics, not lgetxattr semantics. To read from an
already open file without resolving its pathname again, use
File::get_xattr.
The value is written from the start of buffer, using its full capacity.
On success, the result is the value’s length and the buffer’s initialized
length advances to at least that length. With zero capacity, only the
required length is returned and the buffer remains empty. The attribute
may change between a sizing query and a subsequent read.
A missing attribute returns ENODATA; insufficient nonzero capacity returns
ERANGE. Other OS errors are preserved. A path or name containing a NUL
byte returns io::ErrorKind::InvalidInput. Errors return the original
buffer without advancing its initialized length.
The submitted operation owns the path, name, and buffer until completion, even if this future is dropped. Cancellation does not return the buffer to the caller.