unsafe fn destroy(&mut self) {
        let mut inner = None;
        std::mem::swap(&mut inner, &mut self.inner);
        let inner = inner.unwrap();
        let strong_count = Arc::strong_count(&inner);

        match Arc::try_unwrap(inner) {
            Ok(mut inner) => {
                inner.allocator.destroy();
                inner.device.destroy_device(None);
                ManuallyDrop::drop(&mut inner);
            }
            Err(_arc) => {
                error!("Could not free the allocator, {} other references exist. Have all allocations been dropped?", strong_count - 1);
                #[cfg(debug_assertions)]
                {
                    let mut all_contexts = _arc.all_contexts.lock().unwrap();
                    all_contexts.remove(&self.create_index);
                    for (k, v) in all_contexts.iter_mut() {
                        v.resolve();
                        println!("context allocation: {}\n{:?}", k, v);
                    }
                }
            }
        }
    }
// Gets called by VkDevice when it is destroyed. This will be called one time for all cloned device contexts.
Gets called by VkDevice when it is destroyed. This will be called one time for all cloned device contexts.
Gets called by VkDevice when it is destroyed . This will be called one time for all cloned device contexts .
unsafe fn destroy(&mut self) {
        let mut inner = None;
        std::mem::swap(&mut inner, &mut self.inner);
        let inner = inner.unwrap();
        let strong_count = Arc::strong_count(&inner);
        match Arc::try_unwrap(inner) {
            Ok(mut inner) => {
                inner.allocator.destroy();
                inner.device.destroy_device(None);
                ManuallyDrop::drop(&mut inner);
            }
            Err(_arc) => {
                error!("Could not free the allocator, {} other references exist. Have all allocations been dropped?", strong_count - 1);
                #[cfg(debug_assertions)]
                {
                    let mut all_contexts = _arc.all_contexts.lock().unwrap();
                    all_contexts.remove(&self.create_index);
                    for (k, v) in all_contexts.iter_mut() {
                        v.resolve();
                        println!("context allocation: {}\n{:?}", k, v);
                    }
                }
            }
        }
    }
unsafe fn destroy ( & mut self ) { let mut inner = None ; std :: mem :: swap ( & mut inner , & mut self . inner ) ; let inner = inner . unwrap ( ) ; let strong_count = Arc :: strong_count ( & inner ) ; match Arc :: try_unwrap ( inner ) { Ok ( mut inner ) => { inner . allocator . destroy ( ) ; inner . device . destroy_device ( None ) ; ManuallyDrop :: drop ( & mut inner ) ; } Err ( _arc ) => { error ! ( " " strong_count 1 ) ; # [ cfg ( debug_assertions ) ] { let mut all_contexts = _arc . all_contexts . lock ( ) . unwrap ( ) ; all_contexts . remove ( & self . create_index ) ; for ( k , v ) in all_contexts . iter_mut ( ) { v . resolve ( ) ; println ! ( " \n " k v ) ; } } } } }
Gets called by VkDevice when it is destroyed.
Gets called by VkDevice when it is destroyed .
&mut self
&mut self