pub trait shell_IEnumShellItems: ole_IUnknown {
// Provided methods
fn iter(&self) -> impl Iterator<Item = HrResult<IShellItem>> + '_ { ... }
fn Next(&self) -> HrResult<Option<IShellItem>> { ... }
fn Reset(&self) -> HrResult<()> { ... }
fn Skip(&self, count: u32) -> HrResult<bool> { ... }
}
Available on crate features
kernel
and shell
only.Expand description
This trait is enabled with the shell
feature, and provides methods for
IEnumShellItems
.
Prefer importing this trait through the prelude:
use winsafe::prelude::*;
Provided Methods§
Sourcefn iter(&self) -> impl Iterator<Item = HrResult<IShellItem>> + '_
fn iter(&self) -> impl Iterator<Item = HrResult<IShellItem>> + '_
Returns an iterator over the IShellItem
elements
which calls
IEnumShellItems::Next
internally.
§Examples
Enumerating the items in a folder by iterating over the
IShellItem
objects:
use winsafe::{self as w, prelude::*, co};
let folder = w::SHCreateItemFromParsingName::<w::IShellItem>(
"C:\\Temp",
None::<&w::IBindCtx>,
)?;
let items = folder.BindToHandler::<w::IEnumShellItems>(
None::<&w::IBindCtx>,
&co::BHID::EnumItems,
)?;
for item in items.iter() {
let item = item?;
println!("{}", item.GetDisplayName(co::SIGDN::FILESYSPATH)?);
}
Sourcefn Next(&self) -> HrResult<Option<IShellItem>>
fn Next(&self) -> HrResult<Option<IShellItem>>
IEnumShellItems::Next
method.
Prefer using
IEnumShellItems::iter
,
which is simpler.
Sourcefn Reset(&self) -> HrResult<()>
fn Reset(&self) -> HrResult<()>
IEnumShellItems::Reset
method.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.