Add target.

This commit is contained in:
Tom Alexander
2023-10-27 14:54:54 -04:00
parent c6cf5f75ac
commit 7b01230234
9 changed files with 80 additions and 15 deletions

View File

@@ -0,0 +1,23 @@
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 {
pub(crate) fn new<'parse>(
registry: &mut Registry<'parse>,
target: &organic::types::Target<'parse>,
) -> Result<ITarget, CustomError> {
let id = registry.get_target(target.value);
Ok(ITarget {
id: id.clone(),
value: target.value.to_owned(),
})
}
}