xdg-thumbnail
Freedesktop thumbnail cache primitives for Rust applications.
The crate provides typed APIs for resolving the personal thumbnail cache, constructing canonical original URI identities, validating existing cache entries, reading validated thumbnail PNG bytes, and atomically installing caller-rendered thumbnails. It does not decode original source formats, choose thumbnailers, or apply cleanup policy.
This crate supports Unix-like XDG desktop environments only. Non-Unix targets fail during crate compilation because thumbnail identity, cache permissions, and local path URI construction depend on Unix path bytes and metadata semantics.
xdg-thumbnail is pre-release software. Configuration, API shape, and internal formats may change before a stable release.
Install
Or add the dependency manually:
[]
= "0.1.0"
Scope
Use this crate when an application already owns source acquisition or rendering and needs Freedesktop-compatible cache primitives:
- Resolve
$XDG_CACHE_HOME/thumbnailswith the XDG fallback rules. - Construct canonical personal-cache and shared-repository original URI identities.
- Compute cache paths without reading them.
- Validate existing cache entries and return either validated paths or exact validated PNG bytes.
- Parse Freedesktop thumbnail PNG metadata.
- Normalize and atomically install caller-rendered personal-cache thumbnail PNGs.
- Write opt-in personal-cache failure entries.
- Inspect cache entries for management tools without applying cleanup policy.
The crate does not decode original source formats, select thumbnailer helpers, execute external renderers, decide retry policy, or delete cache entries except through explicit inspection handles.
Lookup Example
use ;
Install Example
use ;
Blocking Adapter Example
Owned request constructors only assemble values and perform no filesystem I/O. Local original identity construction reads filesystem metadata, so async applications should do it inside a runtime-specific blocking adapter.
use ;
Links
- API documentation: https://docs.rs/xdg-thumbnail
- Repository: https://github.com/hnjae/xdg-thumbnail
- Freedesktop Thumbnail Managing Standard: https://specifications.freedesktop.org/thumbnail/latest/
- License: MPL-2.0