Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SystemExt trait #1092

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ It currently supports the following OSes (alphabetically sorted):

You can still use `sysinfo` on non-supported OSes, it'll simply do nothing and always return
empty values. You can check in your program directly if an OS is supported by checking the
[`SystemExt::IS_SUPPORTED`] constant.
[`IS_SUPPORTED`] constant.

The minimum-supported version of `rustc` is **1.63**.

Expand All @@ -36,7 +36,7 @@ Otherwise, here is a little code sample:
```rust
use sysinfo::{
Components, ComponentsExt, Disks, NetworkExt, Networks,
NetworksExt, ProcessExt, System, SystemExt,
NetworksExt, ProcessExt, System,
};

// Please note that we use "new_all" to ensure that all list of
Expand Down Expand Up @@ -100,7 +100,7 @@ Please remember that to have some up-to-date information, you need to call the e
`refresh` method. For example, for the CPU usage:

```rust,no_run
use sysinfo::{CpuExt, System, SystemExt};
use sysinfo::{CpuExt, System};

let mut sys = System::new();

Expand All @@ -111,7 +111,7 @@ loop {
}
// Sleeping to let time for the system to run for long
// enough to have useful information.
std::thread::sleep(System::MINIMUM_CPU_UPDATE_INTERVAL);
std::thread::sleep(sysinfo::MINIMUM_CPU_UPDATE_INTERVAL);
}
```

Expand Down
2 changes: 1 addition & 1 deletion benches/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate test;

use sysinfo::get_current_pid;
use sysinfo::{ComponentsExt, NetworksExt, SystemExt, UsersExt};
use sysinfo::{ComponentsExt, NetworksExt, UsersExt};

#[bench]
fn bench_new(b: &mut test::Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::str::FromStr;
use sysinfo::Signal::*;
use sysinfo::{
Components, ComponentsExt, CpuExt, Disks, NetworkExt, Networks, NetworksExt, Pid, ProcessExt,
Signal, System, SystemExt, UserExt, Users, UsersExt,
Signal, System, UserExt, Users, UsersExt,
};

const signals: &[Signal] = &[
Expand Down
10 changes: 10 additions & 0 deletions md_doc/is_supported.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Returns `true` if this OS is supported. Please refer to the
[crate-level documentation](index.html) to get the list of supported OSes.

```
if sysinfo::IS_SUPPORTED {
println!("This OS is supported!");
} else {
println!("This OS isn't supported (yet?).");
}
```
8 changes: 8 additions & 0 deletions md_doc/minimum_cpu_update_interval.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This is the minimum interval time used internally by `sysinfo` to refresh the CPU time.

⚠️ This value differs from one OS to another.

Why is this constant even needed?

If refreshed too often, the CPU usage of processes will be `0` whereas on Linux it'll
always be the maximum value (`number of CPUs * 100`).
2 changes: 1 addition & 1 deletion md_doc/serde.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
With the `serde` feature enabled, you can then serialize `sysinfo` types. Let's see an example with `serde_json`:

```
use sysinfo::{System, SystemExt};
use sysinfo::System;

let mut sys = System::new_all();
// First we update all information of our `System` struct.
Expand Down
8 changes: 8 additions & 0 deletions md_doc/supported_signals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Returns the list of the supported signals on this system (used by
[`ProcessExt::kill_with`][crate::ProcessExt::kill_with]).

```
use sysinfo::{System, SUPPORTED_SIGNALS};

println!("supported signals: {:?}", SUPPORTED_SIGNALS);
```
1 change: 0 additions & 1 deletion md_doc/system.md

This file was deleted.

4 changes: 1 addition & 3 deletions src/c_interface.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{
CpuExt, Disks, NetworkExt, Networks, NetworksExt, Pid, Process, ProcessExt, System, SystemExt,
};
use crate::{CpuExt, Disks, NetworkExt, Networks, NetworksExt, Pid, Process, ProcessExt, System};
use libc::{self, c_char, c_float, c_uint, c_void, size_t};
use std::borrow::BorrowMut;
use std::ffi::CString;
Expand Down
Loading