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 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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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