pub struct ProposedPlanParser { /* private fields */ }Expand description
Parses <proposed_plan> blocks from streaming text in real-time.
The model emits plans like:
<proposed_plan title="Fix the bug">
1. Read the file
2. Fix the function
3. Run tests
</proposed_plan>The parser accumulates text chunks and extracts the plan when the closing tag is found.
Implementations§
Source§impl ProposedPlanParser
impl ProposedPlanParser
pub fn new() -> Self
Sourcepub fn push_text(&mut self, text: &str) -> Vec<ProposedPlan>
pub fn push_text(&mut self, text: &str) -> Vec<ProposedPlan>
Feed a text delta into the parser. Returns any plans that were completed by this chunk.
Sourcepub fn drain(&mut self) -> Vec<ProposedPlan>
pub fn drain(&mut self) -> Vec<ProposedPlan>
Drain any pending plans (call at end of turn).
Sourcepub fn is_in_plan(&self) -> bool
pub fn is_in_plan(&self) -> bool
Returns true if the parser is currently inside a <proposed_plan> block.
Sourcepub fn partial_body(&self) -> &str
pub fn partial_body(&self) -> &str
Returns the partial plan body being accumulated (for live UI preview).
Sourcepub fn partial_title(&self) -> Option<&str>
pub fn partial_title(&self) -> Option<&str>
Returns the parsed title of the current plan (for live UI preview).
Trait Implementations§
Source§impl Debug for ProposedPlanParser
impl Debug for ProposedPlanParser
Auto Trait Implementations§
impl Freeze for ProposedPlanParser
impl RefUnwindSafe for ProposedPlanParser
impl Send for ProposedPlanParser
impl Sync for ProposedPlanParser
impl Unpin for ProposedPlanParser
impl UnsafeUnpin for ProposedPlanParser
impl UnwindSafe for ProposedPlanParser
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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