aboutsummaryrefslogtreecommitdiff
path: root/arg_picker/src/pickable/multi_pickable.rs
diff options
context:
space:
mode:
Diffstat (limited to 'arg_picker/src/pickable/multi_pickable.rs')
-rw-r--r--arg_picker/src/pickable/multi_pickable.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/arg_picker/src/pickable/multi_pickable.rs b/arg_picker/src/pickable/multi_pickable.rs
index 84a8068..404c23b 100644
--- a/arg_picker/src/pickable/multi_pickable.rs
+++ b/arg_picker/src/pickable/multi_pickable.rs
@@ -5,13 +5,29 @@ use crate::{
};
/// Boundary check for multi-value positional parameters.
+///
+/// Determines whether a raw string marks the end of a multi-value
+/// parameter's input range.
pub trait BoundaryCheck {
+ /// Returns `true` if `raw` indicates a boundary (i.e., the start of
+ /// a new parameter), stopping greedy collection.
fn check_boundary(raw: &str) -> bool;
}
/// Trait for multi-value parameters.
+///
+/// Implementors define how a sequence of raw strings is converted into
+/// a single value, with an associated [`BoundaryCheck`] to control where
+/// collection stops.
pub trait MultiPickableWithBoundary: Sized {
+ /// The boundary checker type that determines when to stop consuming
+ /// positional arguments.
type Checker: BoundaryCheck;
+
+ /// Parse and collect multiple raw string values into `Self`.
+ ///
+ /// The caller should stop passing additional items once the
+ /// associated [`Checker`](Self::Checker) signals a boundary.
fn pick_multi(raw: Vec<String>) -> PickerArgResult<Self>;
}