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
Source§impl Default for ProposedPlanParser
impl Default for ProposedPlanParser
Source§fn default() -> ProposedPlanParser
fn default() -> ProposedPlanParser
Returns the “default value” for a type. Read more
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