natter/src/intermediate/target.rs

24 lines
566 B
Rust
Raw Normal View History

2023-10-27 18:54:54 +00:00
use crate::error::CustomError;
use crate::intermediate::util::coalesce_whitespace;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct ITarget {
pub(crate) id: String,
value: String,
}
impl ITarget {
2023-10-29 18:14:10 +00:00
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
target: &'b organic::types::Target<'parse>,
2023-10-27 18:54:54 +00:00
) -> Result<ITarget, CustomError> {
let id = registry.get_target(target.value);
Ok(ITarget {
id: id.clone(),
value: target.value.to_owned(),
})
}
}