pub struct PackBuilder { /* private fields */ }Implementations§
Source§impl PackBuilder
impl PackBuilder
pub fn new() -> Self
pub fn preset(self, p: Preset) -> Self
pub fn budget(self, b: Budget) -> Self
pub fn max_tokens(self, n: usize) -> Self
pub fn reserve_tokens(self, n: usize) -> Self
pub fn tokenizer(self, t: Tokenizer) -> Self
pub fn scrub(self, on: bool) -> Self
pub fn expand_mode(self, m: ExpandMode) -> Self
pub fn include_path(self, path: impl Into<String>) -> Self
pub fn exclude_path(self, path: impl Into<String>) -> Self
pub fn project_root(self, p: impl Into<PathBuf>) -> Self
pub fn stdin_prompt(self, prompt: impl Into<String>) -> Self
Sourcepub fn files_from(self, paths: Vec<PathBuf>) -> Self
pub fn files_from(self, paths: Vec<PathBuf>) -> Self
Repo-relative paths whose full contents should be embedded in a
dedicated “📂 Scoped Files” section. Designed for the
cargo impact --context | cargo context --files-from - workflow:
the upstream tool tells us which files matter, and we include them
verbatim (subject to scrubbing and budget).
These paths also join the diff-changed set when the related-tests
collector runs, so a test that references a scoped file by stem
gets surfaced even when the scoped file isn’t in git diff.
Sourcepub fn impact_findings(self, findings: Vec<Finding>) -> Self
pub fn impact_findings(self, findings: Vec<Finding>) -> Self
Findings pulled from a cargo-impact --format=json envelope.
Differs from Self::files_from in that each finding carries
metadata (id, kind, confidence, severity, tier, evidence,
suggested action) that can drive richer rendering:
- In the default aggregated mode, the list is rendered as a single “📂 Scoped Files” section with files ordered by the caller-supplied order (typically confidence-descending) and per-file headers that surface confidence/severity/tier.
- When
Self::impact_per_findingis set, each finding becomes its own “📂 Impact: …” section — useful when an agent wants to iterate through findings one at a time.
Finding paths join the diff-changed set for related-tests linkage,
mirroring files_from.
Sourcepub fn impact_per_finding(self, on: bool) -> Self
pub fn impact_per_finding(self, on: bool) -> Self
Emit one pack section per finding instead of one aggregated
section. No-op when impact_findings is empty.
Sourcepub fn build(self) -> Result<Pack>
pub fn build(self) -> Result<Pack>
Assemble the pack.
Flow:
- Collect candidate sections per preset (collectors that fail for
expected reasons return
None— a missing git repo or Cargo.toml never aborts the build). - Run the scrubber over each section’s content. Scrubbing may shrink or grow content, so we re-count tokens after it.
- Reconcile with the token budget using the configured strategy.
Dropped section names are surfaced on
Pack.dropped.
Trait Implementations§
Source§impl Clone for PackBuilder
impl Clone for PackBuilder
Source§fn clone(&self) -> PackBuilder
fn clone(&self) -> PackBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PackBuilder
impl Debug for PackBuilder
Auto Trait Implementations§
impl Freeze for PackBuilder
impl RefUnwindSafe for PackBuilder
impl Send for PackBuilder
impl Sync for PackBuilder
impl Unpin for PackBuilder
impl UnsafeUnpin for PackBuilder
impl UnwindSafe for PackBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more