feat(tvix/eval): add SharedThunkSet
This is a ThunkSet wrapped to be shareable, which will be required once ThunkSets are embedded in futures. Change-Id: I5a067b7972ac86e4d354c75ef05c86b2284c1137 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8144 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
		
							parent
							
								
									dccbda5960
								
							
						
					
					
						commit
						e1f082a3ab
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -488,3 +488,14 @@ impl ThunkSet {
 | 
			
		|||
        self.0.insert(ptr)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Default, Clone)]
 | 
			
		||||
pub struct SharedThunkSet(Rc<RefCell<ThunkSet>>);
 | 
			
		||||
 | 
			
		||||
impl SharedThunkSet {
 | 
			
		||||
    /// Check whether the given thunk has already been seen. Will mark the thunk
 | 
			
		||||
    /// as seen otherwise.
 | 
			
		||||
    pub fn insert(&self, thunk: &Thunk) -> bool {
 | 
			
		||||
        self.0.borrow_mut().insert(thunk)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue