Skip to main content

bast3st_eval/evaluation/
context.rs

1use std::{collections::BTreeMap, sync::Arc};
2
3use scratch_test_interpreter::Limits;
4use scratch_test_model::{Id, ProjectDoc};
5
6use crate::{
7    evaluation::single_evaluation::AllowedNetClosure,
8    spec::{Entity, EntityId},
9};
10
11#[derive(derive_more::Debug, Clone)]
12pub struct Context {
13    pub max_list_length: u32,
14    pub limits: Limits,
15    pub doc: ProjectDoc,
16    pub initial_block: Id,
17    pub entities: Arc<BTreeMap<EntityId, Entity>>,
18    #[debug("allowed_network: ...")]
19    pub allowed_network: AllowedNetClosure,
20}
21impl Context {
22    pub fn entities(&self) -> &BTreeMap<EntityId, Entity> {
23        &self.entities
24    }
25    pub fn initial_block(&self) -> &Id {
26        &self.initial_block
27    }
28    pub fn doc(&self) -> &ProjectDoc {
29        &self.doc
30    }
31    pub fn max_list_length(&self) -> u32 {
32        self.max_list_length
33    }
34    pub fn limits(&self) -> &Limits {
35        &self.limits
36    }
37    pub fn allowed_network(&self) -> &AllowedNetClosure {
38        &self.allowed_network
39    }
40}