Skip to content

Commit 67646c6

Browse files
committed
docs: update docs
1 parent 111508f commit 67646c6

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

crates/libs/kill_tree/src/blocking.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,27 @@ pub fn kill_tree(process_id: ProcessId) -> Result<Outputs> {
132132
/// Ok(())
133133
/// }
134134
/// ```
135+
///
136+
/// /// # Errors
137+
///
138+
/// ## `InvalidProcessId`
139+
/// Returns the process ID of the kernel or system, or if greater than the available maximum process ID.
140+
///
141+
/// ## `InvalidCast`
142+
/// Returned internally when an invalid type conversion occurs during a system API call.
143+
/// This is an error that should not occur under normal circumstances.
144+
///
145+
/// ## `InvalidProcEntry`
146+
/// Returned when inquiry, or parsing within the Linux `/proc/` path fails.
147+
///
148+
/// ## `Io`
149+
/// Returned when access within the Linux `/proc/` path fails.
150+
///
151+
/// ## `Windows`
152+
/// Returned when the `Win32` API used internally fails.
153+
///
154+
/// ## `Unix`
155+
/// Returned when the `libc` API used internally fails.
135156
pub fn kill_tree_with_config(process_id: ProcessId, config: &Config) -> Result<Outputs> {
136157
imp::validate_process_id(process_id)?;
137158
let process_infos_provider = imp::blocking::ProcessInfosProvider {};

crates/libs/kill_tree/src/tokio.rs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,31 @@ pub fn get_available_max_process_id() -> u32 {
5959
/// };
6060
///
6161
/// fn main() -> Result<()> {
62-
/// let _ = kill_tree(get_available_max_process_id())?;
62+
/// let _ = kill_tree(get_available_max_process_id()).await?;
6363
/// Ok(())
6464
/// }
6565
/// ```
66+
///
67+
/// # Errors
68+
///
69+
/// ## `InvalidProcessId`
70+
/// Returns the process ID of the kernel or system, or if greater than the available maximum process ID.
71+
///
72+
/// ## `InvalidCast`
73+
/// Returned internally when an invalid type conversion occurs during a system API call.
74+
/// This is an error that should not occur under normal circumstances.
75+
///
76+
/// ## `InvalidProcEntry`
77+
/// Returned when inquiry, or parsing within the Linux `/proc/` path fails.
78+
///
79+
/// ## `Io`
80+
/// Returned when access within the Linux `/proc/` path fails.
81+
///
82+
/// ## `Windows`
83+
/// Returned when the `Win32` API used internally fails.
84+
///
85+
/// ## `Unix`
86+
/// Returned when the `libc` API used internally fails.
6687
pub async fn kill_tree(process_id: ProcessId) -> Result<Outputs> {
6788
kill_tree_with_config(process_id, &Config::default()).await
6889
}
@@ -111,6 +132,27 @@ pub async fn kill_tree(process_id: ProcessId) -> Result<Outputs> {
111132
/// Ok(())
112133
/// }
113134
/// ```
135+
///
136+
/// # Errors
137+
///
138+
/// ## `InvalidProcessId`
139+
/// Returns the process ID of the kernel or system, or if greater than the available maximum process ID.
140+
///
141+
/// ## `InvalidCast`
142+
/// Returned internally when an invalid type conversion occurs during a system API call.
143+
/// This is an error that should not occur under normal circumstances.
144+
///
145+
/// ## `InvalidProcEntry`
146+
/// Returned when inquiry, or parsing within the Linux `/proc/` path fails.
147+
///
148+
/// ## `Io`
149+
/// Returned when access within the Linux `/proc/` path fails.
150+
///
151+
/// ## `Windows`
152+
/// Returned when the `Win32` API used internally fails.
153+
///
154+
/// ## `Unix`
155+
/// Returned when the `libc` API used internally fails.
114156
pub async fn kill_tree_with_config(process_id: ProcessId, config: &Config) -> Result<Outputs> {
115157
imp::validate_process_id(process_id)?;
116158
let process_infos_provider = imp::tokio::ProcessInfosProvider {};

0 commit comments

Comments
 (0)