mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
19 lines
534 B
Rust
19 lines
534 B
Rust
use mlua::UserData;
|
|
|
|
use super::Status;
|
|
|
|
pub struct Output {
|
|
inner: std::process::Output,
|
|
}
|
|
|
|
impl Output {
|
|
pub fn new(inner: std::process::Output) -> Self { Self { inner } }
|
|
}
|
|
|
|
impl UserData for Output {
|
|
fn add_fields<F: mlua::UserDataFields<Self>>(fields: &mut F) {
|
|
fields.add_field_method_get("status", |_, me| Ok(Status::new(me.inner.status)));
|
|
fields.add_field_method_get("stdout", |lua, me| lua.create_string(&me.inner.stdout));
|
|
fields.add_field_method_get("stderr", |lua, me| lua.create_string(&me.inner.stderr));
|
|
}
|
|
}
|