pub trait MediaDirsExt: Sized {
// Required method
fn known_folders() -> Result<Self>;
}std.fs_media_dirs #162083)Expand description
Windows-specific extensions to fs::MediaDirs.
Required Methods§
Sourcefn known_folders() -> Result<Self>
🔬This is a nightly-only experimental API. (fs_media_dirs #162083)
fn known_folders() -> Result<Self>
fs_media_dirs #162083)Load the known user folder paths using the Known Folders API.
The loaded known folders are:
MediaDirs | KNOWNFOLDERID |
|---|---|
desktop | FOLDERID_Desktop (%USERPROFILE%\Desktop) |
documents | FOLDERID_Documents (%USERPROFILE%\Documents) |
downloads | FOLDERID_Downloads (%USERPROFILE%\Downloads) |
music | FOLDERID_Music (%USERPROFILE%\Music) |
pictures | FOLDERID_Pictures (%USERPROFILE%\Pictures) |
videos | FOLDERID_Videos (%USERPROFILE%\Videos) |
§Errors
Errors if the underlying system discovery API returns an error. The
lack of a configured path is not considered an error and results in a
None value.
§Implementation-specific behavior
Calls SHGetKnownFolderPath for the current user once for each known
folder. Does not create the folder if missing.
COM should be initialized on the thread that calls this function or else it may return unexpected errors.
This behavior may change in the future. One example change that we explicitly reserve the right to make is to load additional common directories not currently in this list.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".