polyhorn_ios/raw/environment.rs
1use polyhorn_ui::layout::LayoutTree;
2use std::sync::{Arc, RwLock};
3
4/// Opaque type that wraps the shared layout tree.
5pub struct Environment {
6 layout_tree: Arc<RwLock<LayoutTree>>,
7}
8
9impl Environment {
10 /// Returns a new environment with the given layout tree.
11 pub fn new(layout_tree: Arc<RwLock<LayoutTree>>) -> Environment {
12 Environment { layout_tree }
13 }
14
15 /// Returns a reference to the shared layout tree.
16 pub fn layout_tree(&mut self) -> &Arc<RwLock<LayoutTree>> {
17 &self.layout_tree
18 }
19}