(&self, f: F)
| 1693 | } |
| 1694 | |
| 1695 | fn resolve_app_context<F, T>(&self, f: F) -> Result<T> |
| 1696 | where |
| 1697 | for<'a> F: FnOnce(RwLockReadGuard<'a, AppContext>) -> Result<T>, |
| 1698 | { |
| 1699 | let app_context = match self.app_context.upgrade() { |
| 1700 | Some(context) => context, |
| 1701 | None => return Err(Error::Defunct), |
| 1702 | }; |
| 1703 | let app_context = app_context.read().unwrap(); |
| 1704 | f(app_context) |
| 1705 | } |
| 1706 | |
| 1707 | pub fn name(&self) -> Result<String> { |
| 1708 | self.resolve_app_context(|context| Ok(context.name.clone().unwrap_or_default())) |
no test coverage detected