mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat!: introduce Path as a subset of Url to enforce type safety
This commit is contained in:
parent
76fe6d7244
commit
a209f20f18
1 changed files with 3 additions and 0 deletions
|
|
@ -115,6 +115,9 @@ impl UserData for Path {
|
||||||
cached_field!(fields, stem, |lua, me| {
|
cached_field!(fields, stem, |lua, me| {
|
||||||
me.stem().map(|s| lua.create_string(s.encoded_bytes())).transpose()
|
me.stem().map(|s| lua.create_string(s.encoded_bytes())).transpose()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fields.add_field_method_get("is_absolute", |_, me| Ok(me.is_absolute()));
|
||||||
|
fields.add_field_method_get("has_root", |_, me| Ok(me.has_root()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
|
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue