Skip to main content

ShellItem

Struct ShellItem 

Source
#[non_exhaustive]
pub struct ShellItem { pub class: u8, pub kind: ShellItemKind, pub name: Option<String>, pub long_name: Option<String>, pub file_size: Option<u32>, pub modified: Option<i64>, pub created: Option<i64>, pub accessed: Option<i64>, pub mft_entry: Option<u64>, pub mft_sequence: Option<u16>, pub guid: Option<String>, pub raw: Vec<u8>, }
Expand description

One decoded shell item — a single component of an ITEMIDLIST.

Fields are populated on a best-effort, per-class basis; a field that does not apply to the item’s class, or that was absent/truncated in the bytes, is None. The raw item bytes (including the cb size prefix) are always retained in ShellItem::raw so a consumer can re-inspect or surface the class byte for an ShellItemKind::Unknown item.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§class: u8

The raw class-type indicator byte (offset 2 of the item).

§kind: ShellItemKind

The decoded class family.

§name: Option<String>

The item’s short / display name (DOS short name for a file entry, drive string for a volume, GUID display label for a root item).

§long_name: Option<String>

The long (Unicode) name from the 0xbeef0004 extension block, when the item is a file entry and the block is present.

§file_size: Option<u32>

The file size (u32) for a file-entry item.

§modified: Option<i64>

Last-modified timestamp (Unix epoch seconds, UTC) — the file entry’s FAT date/time.

§created: Option<i64>

Creation timestamp (Unix epoch seconds, UTC) from the 0xbeef0004 extension block.

§accessed: Option<i64>

Last-access timestamp (Unix epoch seconds, UTC) from the 0xbeef0004 extension block.

§mft_entry: Option<u64>

NTFS MFT entry index (48-bit) from the 0xbeef0004 file reference, when the extension version is high enough to carry it.

§mft_sequence: Option<u16>

NTFS MFT sequence number (16-bit) from the 0xbeef0004 file reference.

§guid: Option<String>

Shell-folder GUID for a root item, in canonical upper-case form.

§raw: Vec<u8>

The full raw bytes of this item, including the 2-byte cb size prefix.

Implementations§

Source§

impl ShellItem

Source

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

The best available display name for this item, preferring the most specific: long name → short/display name → GUID. Returns None only when the item carries no usable label at all.

Trait Implementations§

Source§

impl Clone for ShellItem

Source§

fn clone(&self) -> ShellItem

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ShellItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ShellItem

Source§

impl PartialEq for ShellItem

Source§

fn eq(&self, other: &ShellItem) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ShellItem

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.