MDItem

Struct MDItem 

Source
pub struct MDItem(/* private fields */);
Expand description

A wrapper around macOS Metadata Item (MDItem). Provides access to file and directory metadata through the Spotlight metadata framework.

Implementations§

Source§

impl MDItem

Source

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>

Creates a new MDItem from a file path.

§Arguments
  • path - A path to a file or directory
§Returns
  • Result<Self> - A new MDItem instance or an error
§Errors
  • Returns an error if the path is invalid or if the MDItem creation fails
Source

pub fn get_attribute_names(&self) -> Vec<String>

Retrieves all available attribute names for this MDItem.

§Returns
  • Vec<String> - A vector of attribute name strings
Source

pub fn get_attribute<T: Sized + ConcreteType>( &self, name: &str, ) -> Option<CFRetained<T>>

Gets a specific attribute from the MDItem.

§Arguments
  • name - The name of the attribute to retrieve
§Returns
  • Option<CFRetained<T>> - The attribute value cast to the specified type, or None if not available
Source

pub fn path(&self) -> Option<PathBuf>

Retrieves the file path of this MDItem.

§Returns
  • Option<PathBuf> - The file path, or None if not available
Source

pub fn display_name(&self) -> Option<String>

Retrieves the display name of this MDItem.

§Returns
  • Option<String> - The display name, or None if not available

Auto Trait Implementations§

§

impl Freeze for MDItem

§

impl RefUnwindSafe for MDItem

§

impl Send for MDItem

§

impl Sync for MDItem

§

impl Unpin for MDItem

§

impl UnwindSafe for MDItem

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,