Skip to content

Commit

Permalink
Core: resource: Implement Conversion trait for rusage -> RUsage
Browse files Browse the repository at this point in the history
  • Loading branch information
envp committed Mar 7, 2021
1 parent cfb73c7 commit 3776a7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion coreutils_core/src/os/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -67,7 +69,7 @@ pub struct IOUsage {
pub num_signals: u64,
}

impl RUsage {
impl From<rusage> for RUsage {
fn from(ru: rusage) -> Self {
RUsage {
timing: Timing { user_time: ru.ru_utime, sys_time: ru.ru_stime },
Expand Down

0 comments on commit 3776a7c

Please sign in to comment.