Skip to content

Commit f274394

Browse files
committed
fix documentation in modes module
1 parent 775ae5f commit f274394

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

bear/src/modes/execution.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait Consumer: Send {
2727
///
2828
/// # Returns
2929
/// * `Ok(())` - All items were successfully processed
30-
/// * `Err(FormatError)` - An error occurred during processing
30+
/// * `Err(WriterError)` - An error occurred during processing
3131
fn consume(self: Box<Self>, receiver: Receiver<intercept::Event>) -> Result<(), WriterError>;
3232
}
3333

@@ -48,7 +48,7 @@ pub trait Producer: Send + Sync {
4848
///
4949
/// # Returns
5050
/// * `Ok(())` - All items were successfully produced
51-
/// * `Err(ReportingError)` - An error occurred during production
51+
/// * `Err(ReporterError)` - An error occurred during production
5252
fn produce(
5353
&self,
5454
sender: crossbeam_channel::Sender<intercept::Event>,
@@ -65,7 +65,7 @@ pub trait Cancellable: Send + Sync {
6565
///
6666
/// # Returns
6767
/// * `Ok(())` - Cancellation was successful
68-
/// * `Err(ReportingError)` - An error occurred during cancellation
68+
/// * `Err(ReporterError)` - An error occurred during cancellation
6969
fn cancel(&self) -> Result<(), ReporterError>;
7070
}
7171

bear/src/modes/mod.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// SPDX-License-Identifier: GPL-3.0-or-later
22

3+
//! # Execution Modes
4+
//!
5+
//! This module provides the core execution patterns for Bear's operation modes.
6+
//! It defines traits and implementations for the producer-consumer pattern
7+
//! used throughout the application.
8+
39
mod execution;
410

511
use crate::intercept::environment;
@@ -8,16 +14,19 @@ use crate::{args, config, output};
814
use std::process::ExitCode;
915
use std::sync::Arc;
1016

11-
/// Represent the modes the application can run in.
17+
/// Represents the application execution modes.
18+
///
19+
/// Bear supports three user-facing modes:
20+
/// - **Intercept only**: Capture build commands and write them to a file for later analysis.
21+
/// - **Semantic only**: Read previously captured build commands from a file and analyze them.
22+
/// - **Combined**: Capture build commands and analyze them in real-time.
1223
///
13-
/// To the user the modes are:
14-
/// - intercept only: capture build commands and write them to a file.
15-
/// - semantic only: read build commands from a file and analyze them.
16-
/// - combined: capture build commands and analyze them in one go.
24+
/// Internally, this enum distinguishes between:
25+
/// - `Intercept`: Modes that execute build commands while capturing events (intercept-only and combined)
26+
/// - `Replay`: Modes that process previously captured events (semantic-only)
1727
///
18-
/// This representation of the mode is based on if we are intercepting the build commands
19-
/// or if we are replaying them. If we are analyzing the build events or just writing them
20-
/// to a file is not relevant for the mode itself, but rather for the configuration.
28+
/// The distinction between writing raw events vs. performing semantic analysis
29+
/// is handled by the consumer configuration, not the mode itself.
2130
pub enum Mode {
2231
Intercept(execution::Interceptor, args::BuildCommand),
2332
Replay(execution::Replayer),
@@ -88,11 +97,11 @@ impl Mode {
8897
}
8998
}
9099

91-
/// It actually runs the application mode.
100+
/// Runs the application mode.
92101
///
93-
/// This is when the build command is executed in the intercept mode or
94-
/// when the event file is read in the replay mode. These errors are all
95-
/// run-time errors, the user were passing valid arguments and configurations.
102+
/// This executes the build command in intercept mode or reads the event file in replay mode.
103+
/// All errors returned are runtime errors that occur after valid arguments and configuration
104+
/// have been provided.
96105
pub fn run(self) -> ExitCode {
97106
let status = match self {
98107
Self::Intercept(interceptor, command) => interceptor.run(command),

0 commit comments

Comments
 (0)