Lines Matching refs:ResourceState

78 enum ResourceState {  enum
86 const BORROW: Self = AtomicResourceState::new(ResourceState::Borrow);
87 const NOT_IN_TABLE: Self = AtomicResourceState::new(ResourceState::NotInTable);
89 const fn new(state: ResourceState) -> AtomicResourceState { in new()
97 fn get(&self) -> ResourceState { in get() argument
98 ResourceState::decode(self.index.load(Relaxed), self.generation.load(Relaxed)) in get()
101 fn swap(&self, state: ResourceState) -> ResourceState { in swap() argument
107 ResourceState::decode(index_prev, generation_prev) in swap()
111 impl ResourceState { implementation
117 fn decode(idx: u32, generation: u32) -> ResourceState { in decode() argument
169 ResourceState::Borrow => false, in owned()
170 ResourceState::Taken | ResourceState::NotInTable | ResourceState::Index(_) => true, in owned()
184 ResourceState::Borrow => { in lower_to_index()
192 ResourceState::NotInTable => { in lower_to_index()
193 let prev = self.state.swap(ResourceState::Taken); in lower_to_index()
194 assert_eq!(prev, ResourceState::NotInTable); in lower_to_index()
200 ResourceState::Taken => bail!("host resource already consumed"), in lower_to_index()
205 ResourceState::Index(idx) => cx.host_resource_lift_own(idx)?, in lower_to_index()
217 ResourceState::Borrow => self.rep, in lower_to_index()
221 ResourceState::Taken => bail!("host resource already consumed"), in lower_to_index()
233 ResourceState::NotInTable => { in lower_to_index()
235 let prev = self.state.swap(ResourceState::Index(idx)); in lower_to_index()
236 assert_eq!(prev, ResourceState::NotInTable); in lower_to_index()
242 ResourceState::Index(idx) => cx.host_resource_lift_borrow(idx)?, in lower_to_index()
297 ResourceState::Borrow => (tables.host_resource_lower_borrow(rep)?, false), in try_into_resource_any()
298 ResourceState::NotInTable => { in try_into_resource_any()
302 ResourceState::Taken => bail!("host resource already consumed"), in try_into_resource_any()
303 ResourceState::Index(idx) => (idx, true), in try_into_resource_any()
388 ResourceState::Borrow => "borrow", in fmt()
389 ResourceState::NotInTable => "own (not in table)", in fmt()
390 ResourceState::Taken => "taken", in fmt()
391 ResourceState::Index(_) => "own", in fmt()