Skip to main content

PromptContentBuilder

Struct PromptContentBuilder 

Source
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>

Source

pub fn new(workspace: &'a dyn Workspace) -> Self

Create a new builder with a workspace reference.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.