pub struct CodeExtractor { /* private fields */ }Expand description
Strategy object that extracts code from an assistant response.
Each call to Self::extract returns the first matching snippet found,
or None if no code was extracted. The extractor is deterministic for
MarkdownFence and Regex strategies; the Llm strategy is inherently
judge-backed and therefore non-deterministic.
Implementations§
Source§impl CodeExtractor
impl CodeExtractor
Sourcepub const fn new(strategy: CodeExtractorStrategy) -> Self
pub const fn new(strategy: CodeExtractorStrategy) -> Self
Create an extractor with the given strategy.
Sourcepub const fn markdown_fence() -> Self
pub const fn markdown_fence() -> Self
Convenience: markdown-fence extractor with no language requirement.
Auto Trait Implementations§
impl Freeze for CodeExtractor
impl !RefUnwindSafe for CodeExtractor
impl Send for CodeExtractor
impl Sync for CodeExtractor
impl Unpin for CodeExtractor
impl UnsafeUnpin for CodeExtractor
impl !UnwindSafe for CodeExtractor
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