pub struct PromptContentBuilder<'a> { /* private fields */ }Expand description
Builder for constructing prompt content with size-aware references.
This builder encapsulates the logic for determining whether content should be embedded inline or referenced by file path.
Implementations§
Source§impl<'a> PromptContentBuilder<'a>
impl<'a> PromptContentBuilder<'a>
Sourcepub fn new(workspace: &'a dyn Workspace) -> Self
pub fn new(workspace: &'a dyn Workspace) -> Self
Create a new builder with a workspace reference.
Sourcepub fn with_prompt(self, content: String) -> Self
pub fn with_prompt(self, content: String) -> Self
Add PROMPT content with automatic size checking.
If the content exceeds [MAX_INLINE_CONTENT_SIZE], the builder will
create a reference to the backup file instead of embedding inline.
Sourcepub fn with_plan(self, content: String) -> Self
pub fn with_plan(self, content: String) -> Self
Add PLAN content with automatic size checking.
If the content exceeds [MAX_INLINE_CONTENT_SIZE], the builder will
create instructions to read from .agent/PLAN.md with optional XML fallback.
Sourcepub fn with_diff(self, content: String, start_commit: &str) -> Self
pub fn with_diff(self, content: String, start_commit: &str) -> Self
Add DIFF content with automatic size checking.
If the content exceeds [MAX_INLINE_CONTENT_SIZE], the builder will
create instructions to use git diff instead of embedding inline.
Sourcepub fn build(self) -> PromptContentReferences
pub fn build(self) -> PromptContentReferences
Build the references.
Note: Backup files should be created before calling build() if needed. This builder only determines how content should be referenced.
Sourcepub fn has_oversize_content(&self) -> bool
pub fn has_oversize_content(&self) -> bool
Check if any content exceeds the inline size limit.
This is useful for logging or debugging to see when content will be referenced by file path instead of embedded inline.
Auto Trait Implementations§
impl<'a> Freeze for PromptContentBuilder<'a>
impl<'a> !RefUnwindSafe for PromptContentBuilder<'a>
impl<'a> Send for PromptContentBuilder<'a>
impl<'a> Sync for PromptContentBuilder<'a>
impl<'a> Unpin for PromptContentBuilder<'a>
impl<'a> !UnwindSafe for PromptContentBuilder<'a>
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> 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