protospec-build 0.3.0

One binary format language to rule them all, One binary format language to find them, One binary format language to bring them all and in the darkness bind them.
Documentation
use super::*;

impl Scope {
    pub fn resolve_field(self_: &Arc<RefCell<Scope>>, name: &str) -> Option<Arc<Field>> {
        if let Some(field) = self_.borrow().declared_fields.get(name) {
            Some(field.clone())
        } else if let Some(parent) = self_.borrow().parent_scope.as_ref() {
            Scope::resolve_field(parent, name)
        } else {
            None
        }
    }

    pub fn resolve_input(self_: &Arc<RefCell<Scope>>, name: &str) -> Option<Arc<Input>> {
        if let Some(field) = self_.borrow().declared_inputs.get(name) {
            Some(field.clone())
        } else if let Some(parent) = self_.borrow().parent_scope.as_ref() {
            Scope::resolve_input(parent, name)
        } else {
            None
        }
    }
}