Skip to main content

file_system/operations/
attribute.rs

1use crate::{Attributes, Result};
2
3pub trait AttributeOperations {
4    /// Populate the requested attributes for the open file or directory.
5    ///
6    /// On entry, `attributes.get_mask()` is the request mask. On success, the
7    /// mask contains only requested fields that were populated with meaningful
8    /// values. Fields unavailable for this object or backend are omitted. An
9    /// empty mask succeeds without reading any fields.
10    fn get_attributes(
11        &self,
12        context: &mut crate::Context,
13        attributes: &mut Attributes,
14    ) -> Result<()>;
15
16    /// Change the fields selected by `attributes.get_mask()`.
17    ///
18    /// An empty mask succeeds without changing any fields. If any requested
19    /// field is unsupported, return [`crate::IoErrorKind::Unsupported`]
20    /// before changing a supported field. A later backend I/O or permission
21    /// failure does not guarantee rollback of earlier changes.
22    fn set_attributes(&self, context: &mut crate::Context, attributes: &Attributes) -> Result<()>;
23}