| Crates.io | duat-filetype |
| lib.rs | duat-filetype |
| version | 0.3.3 |
| created_at | 2025-06-16 06:04:55.406606+00 |
| updated_at | 2026-01-15 00:38:21.423899+00 |
| description | Filetype detection for the File widget from Duat |
| homepage | |
| repository | https://github.com/AhoyISki/duat-filetype |
| max_upload_size | |
| id | 1713927 |
| size | 156,811 |
Filetypes for the Duat text editor
This Plugin is included by default, as it is considered a core
utility of duat. It adds the two following traits:
FileType: This trait grants the filetype method, which
lets you access the filetype directly. Its implementors are the
Buffer widget, String and &str and PathBuf and
Path.PassFileType: This trait also has a
filetype method, but it requires a
Pass, bypassing the need to, for example, read a
Handle<Buffer>. Its implementors are RwData<Buffer>,
Handle<Buffer>,Both of these traits are included by default in Duat’s
prelude, but if you want to use them in a plugin, first, add
duat-filetype to the dependencies:
cargo add duat-filetype
Or, for latest git version:
cargo add --git https://github.com/AhoyISki/duat-filetype
Then, just use it in the file:
use duat_filetype::FileType;
fn is_toml(file_name: &str) -> bool {
file_name.filetype() == Some("toml")
}