pub async fn teardown(&self) -> Result<(), Error> {
        if !self.debug {
            let mut error = None;
            let mut containers = self.containers.lock().await;

            while containers.len() > 0 {
                let len = containers.len();
                let container = &containers[len - 1];

                match self
                    .docker
                    .lock()
                    .await
                    .remove_container(
                        container,
                        Some(RemoveContainerOptions {
                            force: true,
                            ..Default::default()
                        }),
                    )
                    .await
                {
                    Ok(_) => {}
                    Err(e) => {
                        if EGGSHELLS.lock().await.len() > 1 {
                            error.replace(Err(Error::Docker(DockerError::DeleteContainer(
                                e.to_string(),
                            ))));
                        }
                    }
                }

                containers.remove(len - 1);
            }

            if error.is_some() {
                return error.unwrap();
            }
        }

        Ok(())
    }
/// teardown is what reaps the launch()'d containers. It is called as a part of drop() as well.
teardown is what reaps the launch()'d containers. It is called as a part of drop() as well.
teardown is what reaps the launch () ' d containers . It is called as a part of drop () as well .
pub async fn teardown(&self) -> Result<(), Error> {
        if !self.debug {
            let mut error = None;
            let mut containers = self.containers.lock().await;
            while containers.len() > 0 {
                let len = containers.len();
                let container = &containers[len - 1];
                match self
                    .docker
                    .lock()
                    .await
                    .remove_container(
                        container,
                        Some(RemoveContainerOptions {
                            force: true,
                            ..Default::default()
                        }),
                    )
                    .await
                {
                    Ok(_) => {}
                    Err(e) => {
                        if EGGSHELLS.lock().await.len() > 1 {
                            error.replace(Err(Error::Docker(DockerError::DeleteContainer(
                                e.to_string(),
                            ))));
                        }
                    }
                }
                containers.remove(len - 1);
            }
            if error.is_some() {
                return error.unwrap();
            }
        }
        Ok(())
    }
pub async fn teardown ( & self ) -> Result < ( ) , Error > { if ! self . debug { let mut error = None ; let mut containers = self . containers . lock ( ) . await ; while containers . len ( ) > 0 { let len = containers . len ( ) ; let container = & containers [ len - 1 ] ; match self . docker . lock ( ) . await . remove_container ( container , Some ( RemoveContainerOptions { force : true , .. Default :: default ( ) } ) , ) . await { Ok ( _ ) => { } Err ( e ) => { if EGGSHELLS . lock ( ) . await . len ( ) > 1 { error . replace ( Err ( Error :: Docker ( DockerError :: DeleteContainer ( e . to_string ( ) , ) ) ) ) ; } } } containers . remove ( len - 1 ) ; } if error . is_some ( ) { return error . unwrap ( ) ; } } Ok ( ( ) ) }
teardown is what reaps the launch()'d containers.
teardown is what reaps the launch () ' d containers .
&self
&self