pub struct ExtendedAttribute {
pub name: String,
pub index: u8,
pub value: Vec<u8>,
}Expand description
A single extended attribute, with the name already compressed (prefix stripped) for on-disk storage.
Fields§
§name: StringThe name with its prefix stripped (the “suffix”).
index: u8Prefix index (see XATTR_PREFIXES).
value: Vec<u8>Raw attribute value.
Implementations§
Source§impl ExtendedAttribute
impl ExtendedAttribute
Sourcepub fn new(full_name: &str, value: Vec<u8>) -> Self
pub fn new(full_name: &str, value: Vec<u8>) -> Self
Create from a full attribute name (e.g. “user.mime_type”) and value. The name is automatically compressed by finding the longest matching prefix.
Sourcepub fn compress_name(name: &str) -> (u8, String)
pub fn compress_name(name: &str) -> (u8, String)
Compress an attribute name by finding the longest matching prefix.
Returns (prefix_index, suffix). If no prefix matches, index 0 is
returned and the full name is kept.
Sourcepub fn decompress_name(index: u8, suffix: &str) -> String
pub fn decompress_name(index: u8, suffix: &str) -> String
Reconstruct the full attribute name from a prefix index and suffix.
Sourcepub fn entry_size(&self) -> u32
pub fn entry_size(&self) -> u32
On-disk size of the entry header + name (aligned to 4 bytes). The entry header (XAttrEntry) is 16 bytes.
Sourcepub fn value_size(&self) -> u32
pub fn value_size(&self) -> u32
On-disk size of the value (aligned to 4 bytes).
Sourcepub fn total_size(&self) -> u32
pub fn total_size(&self) -> u32
Total on-disk footprint: entry + value.
Trait Implementations§
Source§impl Clone for ExtendedAttribute
impl Clone for ExtendedAttribute
Source§fn clone(&self) -> ExtendedAttribute
fn clone(&self) -> ExtendedAttribute
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more