natter/src/intermediate/src_block.rs

24 lines
546 B
Rust
Raw Normal View History

2023-10-27 21:08:58 +00:00
use crate::error::CustomError;
use super::registry::Registry;
2023-10-29 14:32:05 +00:00
use super::util::GetFullLines;
2023-10-27 21:08:58 +00:00
#[derive(Debug)]
pub(crate) struct ISrcBlock {
pub(crate) lines: Vec<String>,
}
2023-10-27 21:08:58 +00:00
impl ISrcBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::SrcBlock<'parse>,
) -> Result<ISrcBlock, CustomError> {
2023-10-29 14:32:05 +00:00
let lines = original
.contents
.full_lines()
.map(|s| s.to_owned())
.collect();
Ok(ISrcBlock { lines })
2023-10-27 21:08:58 +00:00
}
}