mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
reverted more spacing
This commit is contained in:
parent
e749c455bf
commit
4c9c6d9d83
3 changed files with 23 additions and 43 deletions
|
|
@ -59,7 +59,5 @@ impl Cha {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Into<yazi_shared::fs::Cha>> Cast<T> for Cha {
|
impl<T: Into<yazi_shared::fs::Cha>> Cast<T> for Cha {
|
||||||
fn cast(lua: &Lua, data: T) -> mlua::Result<AnyUserData> {
|
fn cast(lua: &Lua, data: T) -> mlua::Result<AnyUserData> { lua.create_any_userdata(data.into()) }
|
||||||
lua.create_any_userdata(data.into())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,5 @@ impl File {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Into<yazi_shared::fs::File>> Cast<T> for File {
|
impl<T: Into<yazi_shared::fs::File>> Cast<T> for File {
|
||||||
fn cast(lua: &Lua, data: T) -> mlua::Result<AnyUserData> {
|
fn cast(lua: &Lua, data: T) -> mlua::Result<AnyUserData> { lua.create_any_userdata(data.into()) }
|
||||||
lua.create_any_userdata(data.into())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,17 +20,17 @@ bitflags! {
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Default)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
pub struct Cha {
|
pub struct Cha {
|
||||||
pub kind: ChaKind,
|
pub kind: ChaKind,
|
||||||
pub len: u64,
|
pub len: u64,
|
||||||
pub accessed: Option<SystemTime>,
|
pub accessed: Option<SystemTime>,
|
||||||
pub created: Option<SystemTime>,
|
pub created: Option<SystemTime>,
|
||||||
pub modified: Option<SystemTime>,
|
pub modified: Option<SystemTime>,
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub permissions: libc::mode_t,
|
pub permissions: libc::mode_t,
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub uid: u32,
|
pub uid: u32,
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub gid: u32,
|
pub gid: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Metadata> for Cha {
|
impl From<Metadata> for Cha {
|
||||||
|
|
@ -58,25 +58,25 @@ impl From<Metadata> for Cha {
|
||||||
}
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
kind: ck,
|
kind: ck,
|
||||||
len: m.len(),
|
len: m.len(),
|
||||||
accessed: m.accessed().ok(),
|
accessed: m.accessed().ok(),
|
||||||
// TODO: remove this once https://github.com/rust-lang/rust/issues/108277 is fixed.
|
// TODO: remove this once https://github.com/rust-lang/rust/issues/108277 is fixed.
|
||||||
created: None,
|
created: None,
|
||||||
modified: m.modified().ok(),
|
modified: m.modified().ok(),
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
permissions: {
|
permissions: {
|
||||||
use std::os::unix::prelude::PermissionsExt;
|
use std::os::unix::prelude::PermissionsExt;
|
||||||
m.permissions().mode() as libc::mode_t
|
m.permissions().mode() as libc::mode_t
|
||||||
},
|
},
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
uid: {
|
uid: {
|
||||||
use std::os::unix::fs::MetadataExt;
|
use std::os::unix::fs::MetadataExt;
|
||||||
m.uid()
|
m.uid()
|
||||||
},
|
},
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
gid: {
|
gid: {
|
||||||
use std::os::unix::fs::MetadataExt;
|
use std::os::unix::fs::MetadataExt;
|
||||||
m.gid()
|
m.gid()
|
||||||
},
|
},
|
||||||
|
|
@ -94,44 +94,28 @@ impl Cha {
|
||||||
|
|
||||||
impl Cha {
|
impl Cha {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_dir(&self) -> bool {
|
pub fn is_dir(&self) -> bool { self.kind.contains(ChaKind::DIR) }
|
||||||
self.kind.contains(ChaKind::DIR)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_hidden(&self) -> bool {
|
pub fn is_hidden(&self) -> bool { self.kind.contains(ChaKind::HIDDEN) }
|
||||||
self.kind.contains(ChaKind::HIDDEN)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_link(&self) -> bool {
|
pub fn is_link(&self) -> bool { self.kind.contains(ChaKind::LINK) }
|
||||||
self.kind.contains(ChaKind::LINK)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_orphan(&self) -> bool {
|
pub fn is_orphan(&self) -> bool { self.kind.contains(ChaKind::ORPHAN) }
|
||||||
self.kind.contains(ChaKind::ORPHAN)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_block_device(&self) -> bool {
|
pub fn is_block_device(&self) -> bool { self.kind.contains(ChaKind::BLOCK_DEVICE) }
|
||||||
self.kind.contains(ChaKind::BLOCK_DEVICE)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_char_device(&self) -> bool {
|
pub fn is_char_device(&self) -> bool { self.kind.contains(ChaKind::CHAR_DEVICE) }
|
||||||
self.kind.contains(ChaKind::CHAR_DEVICE)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_fifo(&self) -> bool {
|
pub fn is_fifo(&self) -> bool { self.kind.contains(ChaKind::FIFO) }
|
||||||
self.kind.contains(ChaKind::FIFO)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_socket(&self) -> bool {
|
pub fn is_socket(&self) -> bool { self.kind.contains(ChaKind::SOCKET) }
|
||||||
self.kind.contains(ChaKind::SOCKET)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_exec(&self) -> bool {
|
pub fn is_exec(&self) -> bool {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue