Skip to content

Commit

Permalink
docs: Add a bit of cross-linking.
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Jan 6, 2024
1 parent a8f0f58 commit f01fb31
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ impl SBProcess {
}

/// The current state of this process (running, stopped, exited, etc.).
///
/// See also:
///
/// - [`SBProcess::is_alive()`]
/// - [`SBProcess::is_running()`]
/// - [`SBProcess::is_stopped()`]
/// - [`StateType`]
pub fn state(&self) -> StateType {
unsafe { sys::SBProcessGetState(self.raw) }
}
Expand All @@ -139,6 +146,13 @@ impl SBProcess {
/// This corresponds to the process being in the `Attaching`,
/// `Launching`, `Stopped`, `Running`, `Stepping`, `Crashed`
/// or `Suspended` states.
///
/// See also:
///
/// - [`SBProcess::is_running()`]
/// - [`SBProcess::is_stopped()`]
/// - [`SBProcess::state()`]
/// - [`StateType`]
pub fn is_alive(&self) -> bool {
matches!(
self.state(),
Expand All @@ -156,6 +170,13 @@ impl SBProcess {
///
/// This corresponds to the process being in the `Running`
/// or `Stepping` states.
///
/// See also:
///
/// - [`SBProcess::is_alive()`]
/// - [`SBProcess::is_stopped()`]
/// - [`SBProcess::state()`]
/// - [`StateType`]
pub fn is_running(&self) -> bool {
matches!(self.state(), StateType::Running | StateType::Stepping)
}
Expand All @@ -164,6 +185,13 @@ impl SBProcess {
///
/// This corresponds to the process being in the `Stopped`, `Crashed`,
/// or `Suspended` states.
///
/// See also:
///
/// - [`SBProcess::is_alive()`]
/// - [`SBProcess::is_running()`]
/// - [`SBProcess::state()`]
/// - [`StateType`]
pub fn is_stopped(&self) -> bool {
matches!(
self.state(),
Expand All @@ -173,12 +201,24 @@ impl SBProcess {

/// The exit status of the process when the process state is
/// `Exited`.
///
/// See also:
///
/// - [`SBProcess::exit_description()`]
/// - [`SBProcess::state()`]
/// - [`StateType`]
pub fn exit_status(&self) -> i32 {
unsafe { sys::SBProcessGetExitStatus(self.raw) }
}

/// The exit description of the process when the process state
/// is `Exited`.
///
/// See also:
///
/// - [`SBProcess::exit_status()`]
/// - [`SBProcess::state()`]
/// - [`StateType`]
pub fn exit_description(&self) -> &str {
unsafe {
match CStr::from_ptr(sys::SBProcessGetExitDescription(self.raw)).to_str() {
Expand Down Expand Up @@ -375,6 +415,8 @@ impl SBProcess {
/// Returns the address of the allocated buffer in the process or
/// the error that occurred while trying to allocate.
///
/// The allocated memory can be deallocated with [`SBProcess::deallocate_memory()`].
///
/// # Example
///
/// ```no_run
Expand Down
2 changes: 1 addition & 1 deletion src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::ffi::CStr;
/// be associated with multiple threads.
///
/// The available queues within a process can be found discovered by
/// inspecting the [`process`]:
/// inspecting the [`process`] via [`SBProcess::queues()`]:
///
/// ```no_run
/// # use lldb::{SBProcess, SBQueue};
Expand Down

0 comments on commit f01fb31

Please sign in to comment.