yazi/yazi-plugin/src/bindings/layer.rs
2025-01-26 01:54:18 +08:00

14 lines
383 B
Rust

use mlua::{MetaMethod, UserData};
#[derive(Clone, Copy)]
pub struct Layer(yazi_shared::Layer);
impl From<yazi_shared::Layer> for Layer {
fn from(event: yazi_shared::Layer) -> Self { Self(event) }
}
impl UserData for Layer {
fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
methods.add_meta_method(MetaMethod::ToString, |_, me, ()| Ok(me.0.to_string()));
}
}