From 3776a7c8506ba31e3199b421213bc88dd0f6c196 Mon Sep 17 00:00:00 2001 From: Vaibhav Yenamandra <3663231+envp@users.noreply.github.com> Date: Sun, 7 Mar 2021 12:35:56 -0500 Subject: [PATCH] Core: resource: Implement Conversion trait for rusage -> RUsage --- coreutils_core/src/os/resource.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coreutils_core/src/os/resource.rs b/coreutils_core/src/os/resource.rs index ff947b3f..02fa223e 100644 --- a/coreutils_core/src/os/resource.rs +++ b/coreutils_core/src/os/resource.rs @@ -6,6 +6,8 @@ use super::TimeVal; use libc::getrusage; use libc::{c_int, rusage, RUSAGE_CHILDREN, RUSAGE_SELF}; +use std::convert::From; + /// Interface for `RUSAGE_*` constants from libc. /// /// TODO This is an incomplete set of constants. It is currently missing @@ -67,7 +69,7 @@ pub struct IOUsage { pub num_signals: u64, } -impl RUsage { +impl From for RUsage { fn from(ru: rusage) -> Self { RUsage { timing: Timing { user_time: ru.ru_utime, sys_time: ru.ru_stime },