Skip to content

Commit 52eeaed

Browse files
committed
docs: Add some clarifying doc comments
1 parent a2aba86 commit 52eeaed

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

rust/boil/src/build/bakefile.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ impl IntoIterator for Targets {
105105
}
106106

107107
impl Targets {
108+
/// Returns a map of all targets by globbing for (nested) image config files.
109+
///
110+
/// The search behaviour can be customized using the provided [`TargetsOptions`].
108111
pub fn all(options: TargetsOptions) -> Result<Self, TargetsError> {
109112
let image_config_paths = glob(ImageConfig::ALL_CONFIGS_GLOB_PATTERN)
110113
.expect("glob pattern must be valid")
@@ -130,6 +133,9 @@ impl Targets {
130133
Ok(targets)
131134
}
132135

136+
/// Returns a filtered set out of all targets by looking up selected image config files.
137+
///
138+
/// The search behaviour can be customized using the provided [`TargetsOptions`].
133139
pub fn set(images: &[Image], options: TargetsOptions) -> Result<Self, TargetsError> {
134140
let mut targets = Self::default();
135141

rust/boil/src/main.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ mod build;
1818
mod completions;
1919
mod show;
2020

21+
/// This trait extends functionailty provided by [`snafu`].
22+
///
23+
/// [`snafu`] already provides various ways to extend [`Result`]s with additional context-sensitive
24+
/// information. This trait allows calling `if_context` on any type, which runs a predicate to
25+
/// determine if an error with the provided context should be returned.
26+
///
27+
/// This trait can be thought of as a combination of [`snafu::ensure!`] and returning [`Ok`]
28+
/// afterwards.
2129
pub trait IfContext: Sized {
30+
/// Runs `predicate` and returns [`Ok`] if `true` or [`Err`] (with data from `context`) otherwise.
2231
fn if_context<P, C, E>(self, predicate: P, context: C) -> Result<Self, E>
2332
where
2433
P: Fn(&Self) -> bool,
@@ -50,7 +59,13 @@ pub trait VersionExt {
5059

5160
impl VersionExt for Version {
5261
fn base(&self) -> String {
53-
let Self {major, minor, patch, ..} = self;
62+
let Self {
63+
major,
64+
minor,
65+
patch,
66+
..
67+
} = self;
68+
5469
format!("{major}.{minor}.{patch}")
5570
}
5671

0 commit comments

Comments
 (0)