diff --git a/yazi-dds/src/body/cd.rs b/yazi-dds/src/body/cd.rs index 5b6fc9bf..c6711c75 100644 --- a/yazi-dds/src/body/cd.rs +++ b/yazi-dds/src/body/cd.rs @@ -36,11 +36,11 @@ impl IntoLua<'_> for BodyCd<'static> { fn into_lua(self, lua: &Lua) -> mlua::Result { if let Some(Cow::Owned(url)) = Some(self.url).filter(|_| !self.dummy) { lua.create_table_from([ - ("tab", self.tab.as_usize().into_lua(lua)?), + ("tab", self.tab.get().into_lua(lua)?), ("url", lua.create_any_userdata(url)?.into_lua(lua)?), ])? } else { - lua.create_table_from([("tab", self.tab.as_usize())])? + lua.create_table_from([("tab", self.tab.get())])? } .into_lua(lua) } diff --git a/yazi-dds/src/body/hover.rs b/yazi-dds/src/body/hover.rs index 1030d97c..893ca699 100644 --- a/yazi-dds/src/body/hover.rs +++ b/yazi-dds/src/body/hover.rs @@ -32,11 +32,11 @@ impl IntoLua<'_> for BodyHover<'static> { fn into_lua(self, lua: &Lua) -> mlua::Result { if let Some(Cow::Owned(url)) = self.url { lua.create_table_from([ - ("tab", self.tab.as_usize().into_lua(lua)?), + ("tab", self.tab.get().into_lua(lua)?), ("url", lua.create_any_userdata(url)?.into_lua(lua)?), ])? } else { - lua.create_table_from([("tab", self.tab.as_usize())])? + lua.create_table_from([("tab", self.tab.get())])? } .into_lua(lua) } diff --git a/yazi-fm/src/lives/tab.rs b/yazi-fm/src/lives/tab.rs index 7281f1c1..eaff877b 100644 --- a/yazi-fm/src/lives/tab.rs +++ b/yazi-fm/src/lives/tab.rs @@ -23,7 +23,7 @@ impl Tab { pub(super) fn register(lua: &Lua) -> mlua::Result<()> { lua.register_userdata_type::(|reg| { - reg.add_field_method_get("id", |_, me| Ok(me.id.as_usize())); + reg.add_field_method_get("id", |_, me| Ok(me.id.get())); reg.add_method("name", |lua, me, ()| { lua.create_string(me.current.url.name().as_encoded_bytes()) }); diff --git a/yazi-shared/src/fs/op.rs b/yazi-shared/src/fs/op.rs index 975b7162..2f0a7605 100644 --- a/yazi-shared/src/fs/op.rs +++ b/yazi-shared/src/fs/op.rs @@ -43,7 +43,7 @@ impl FilesOp { pub fn prepare(cwd: &Url) -> Id { let ticket = FILES_TICKET.next(); - Self::Part(cwd.clone(), vec![], FILES_TICKET.next()).emit(); + Self::Part(cwd.clone(), vec![], ticket).emit(); ticket } diff --git a/yazi-shared/src/id.rs b/yazi-shared/src/id.rs index e686347e..ab5f1523 100644 --- a/yazi-shared/src/id.rs +++ b/yazi-shared/src/id.rs @@ -7,7 +7,7 @@ pub struct Id(usize); impl Id { #[inline] - pub fn as_usize(&self) -> usize { self.0 } + pub fn get(&self) -> usize { self.0 } } impl Display for Id {