(
&self,
callback: impl FnOnce(&mut State, &Self) -> Result,
)
| 70 | } |
| 71 | |
| 72 | pub fn with_initialized_state<State: Any, Result>( |
| 73 | &self, |
| 74 | callback: impl FnOnce(&mut State, &Self) -> Result, |
| 75 | ) -> Result { |
| 76 | let mut states = self.states.borrow_mut(); |
| 77 | let state = states |
| 78 | .get_mut(&self.element_token) |
| 79 | .expect(&format!( |
| 80 | "Tried to get state that hasn't be initialized for {:?}", |
| 81 | &self.element_token |
| 82 | )) |
| 83 | .downcast_mut() |
| 84 | .expect("Tried to get state with different type than previous fetch"); |
| 85 | |
| 86 | callback(state, self) |
| 87 | } |
| 88 | |
| 89 | pub fn with_state<State: Any + Default, Result>( |
| 90 | &self, |
nothing calls this directly
no outgoing calls
no test coverage detected