rune/parse/
resolve.rs

1use crate::compile;
2use crate::macros::Storage;
3use crate::Sources;
4
5/// A resolve context.
6#[derive(Clone, Copy)]
7pub struct ResolveContext<'a> {
8    /// Sources to use.
9    pub(crate) sources: &'a Sources,
10    /// Storage to use in resolve context.
11    pub(crate) storage: &'a Storage,
12}
13
14/// A type that can be resolved to an internal value based on a source.
15pub trait Resolve<'a> {
16    /// The output type being resolved into.
17    type Output: 'a;
18
19    /// Resolve the value from parsed AST.
20    fn resolve(&self, cx: ResolveContext<'a>) -> compile::Result<Self::Output>;
21}