pub(crate) fn destruct(&mut self) -> NexusState {
        // a closed operation might already be in progress calling unregister
        // will trip an assertion within the external libraries
        if *self.state.lock().unwrap() == NexusState::Closed {
            trace!("{}: already closed", self.name);
            return NexusState::Closed;
        }

        trace!("{}: closing, from state: {:?} ", self.name, self.state);

        let nexus_name = self.name.clone();
        Reactor::block_on(async move {
            let nexus = nexus_lookup(&nexus_name).expect("Nexus not found");
            for child in &mut nexus.children {
                if child.state() == ChildState::Open {
                    if let Err(e) = child.close().await {
                        error!(
                            "{}: child {} failed to close with error {}",
                            nexus.name,
                            child.name,
                            e.verbose()
                        );
                    }
                }
            }
        });

        unsafe {
            spdk_io_device_unregister(self.as_ptr(), None);
        }

        trace!("{}: closed", self.name);
        self.set_state(NexusState::Closed)
    }
/// close the nexus and any children that are open
close the nexus and any children that are open
close the nexus and any children that are open
pub(crate) fn destruct(&mut self) -> NexusState {
        // a closed operation might already be in progress calling unregister
        // will trip an assertion within the external libraries
        if *self.state.lock().unwrap() == NexusState::Closed {
            trace!("{}: already closed", self.name);
            return NexusState::Closed;
        }
        trace!("{}: closing, from state: {:?} ", self.name, self.state);
        let nexus_name = self.name.clone();
        Reactor::block_on(async move {
            let nexus = nexus_lookup(&nexus_name).expect("Nexus not found");
            for child in &mut nexus.children {
                if child.state() == ChildState::Open {
                    if let Err(e) = child.close().await {
                        error!(
                            "{}: child {} failed to close with error {}",
                            nexus.name,
                            child.name,
                            e.verbose()
                        );
                    }
                }
            }
        });
        unsafe {
            spdk_io_device_unregister(self.as_ptr(), None);
        }
        trace!("{}: closed", self.name);
        self.set_state(NexusState::Closed)
    }
pub ( crate ) fn destruct ( & mut self ) -> NexusState { // a closed operation might already be in progress calling unregister // will trip an assertion within the external libraries if * self . state . lock ( ) . unwrap ( ) == NexusState :: Closed { trace ! ( " " self name ) ; return NexusState :: Closed ; } trace ! ( " " self name self state ) ; let nexus_name = self . name . clone ( ) ; Reactor :: block_on ( async move { let nexus = nexus_lookup ( & nexus_name ) . expect ( " " ) ; for child in & mut nexus . children { if child . state ( ) == ChildState :: Open { if let Err ( e ) = child . close ( ) . await { error ! ( " " nexus name child name e verbose ( ) ) ; } } } } ) ; unsafe { spdk_io_device_unregister ( self . as_ptr ( ) , None ) ; } trace ! ( " " self name ) ; self . set_state ( NexusState :: Closed ) }
close the nexus and any children that are open
close the nexus and any children that are open
&mut self