Skip to main content

extract_code_block

Function extract_code_block 

Source
pub fn extract_code_block(response: &str) -> Option<String>
Expand description

Extract the content of the first ```rust ... ``` block in response. Returns None if no such block exists or the block is empty after trimming. Accepts both rust and Rust language tags and both LF and CRLF endings.