fn create_images(&mut self) -> (Vec<usize>, Vec<(usize, Vec<u8>)>) {
        let mut image_ids: Vec<usize> = vec![];
        let mut images: Vec<(usize, Vec<u8>)> = vec![];

        for child in &mut self.document.children {
            match child {
                DocumentChild::Paragraph(paragraph) => {
                    for child in &mut paragraph.children {
                        if let ParagraphChild::Run(run) = child {
                            for child in &mut run.children {
                                if let RunChild::Drawing(d) = child {
                                    if let Some(DrawingData::Pic(pic)) = &mut d.data {
                                        image_ids.push(pic.id);
                                        let b = std::mem::take(&mut pic.image);
                                        images.push((pic.id, b));
                                    }
                                }
                            }
                        }
                    }
                }
                DocumentChild::Table(table) => {
                    for TableChild::TableRow(row) in &mut table.rows {
                        for TableRowChild::TableCell(cell) in &mut row.cells {
                            for content in &mut cell.children {
                                match content {
                                    TableCellContent::Paragraph(paragraph) => {
                                        for child in &mut paragraph.children {
                                            if let ParagraphChild::Run(run) = child {
                                                for child in &mut run.children {
                                                    if let RunChild::Drawing(d) = child {
                                                        if let Some(DrawingData::Pic(pic)) =
                                                            &mut d.data
                                                        {
                                                            image_ids.push(pic.id);
                                                            let b = std::mem::take(&mut pic.image);
                                                            images.push((pic.id, b));
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    TableCellContent::Table(_) => {
                                        // TODO: support comment
                                    }
                                }
                            }
                        }
                    }
                }
                _ => {}
            }
        }
        (image_ids, images)
    }
// Traverse and collect images from document.
Traverse and collect images from document.
Traverse and collect images from document .
fn create_images(&mut self) -> (Vec<usize>, Vec<(usize, Vec<u8>)>) {
        let mut image_ids: Vec<usize> = vec![];
        let mut images: Vec<(usize, Vec<u8>)> = vec![];
        for child in &mut self.document.children {
            match child {
                DocumentChild::Paragraph(paragraph) => {
                    for child in &mut paragraph.children {
                        if let ParagraphChild::Run(run) = child {
                            for child in &mut run.children {
                                if let RunChild::Drawing(d) = child {
                                    if let Some(DrawingData::Pic(pic)) = &mut d.data {
                                        image_ids.push(pic.id);
                                        let b = std::mem::take(&mut pic.image);
                                        images.push((pic.id, b));
                                    }
                                }
                            }
                        }
                    }
                }
                DocumentChild::Table(table) => {
                    for TableChild::TableRow(row) in &mut table.rows {
                        for TableRowChild::TableCell(cell) in &mut row.cells {
                            for content in &mut cell.children {
                                match content {
                                    TableCellContent::Paragraph(paragraph) => {
                                        for child in &mut paragraph.children {
                                            if let ParagraphChild::Run(run) = child {
                                                for child in &mut run.children {
                                                    if let RunChild::Drawing(d) = child {
                                                        if let Some(DrawingData::Pic(pic)) =
                                                            &mut d.data
                                                        {
                                                            image_ids.push(pic.id);
                                                            let b = std::mem::take(&mut pic.image);
                                                            images.push((pic.id, b));
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    TableCellContent::Table(_) => {
                                        // TODO: support comment
                                    }
                                }
                            }
                        }
                    }
                }
                _ => {}
            }
        }
        (image_ids, images)
    }
fn create_images ( & mut self ) -> ( Vec < usize > , Vec < ( usize , Vec < u8 > ) > ) { let mut image_ids : Vec < usize > = vec ! [ ] ; let mut images : Vec < ( usize , Vec < u8 > ) > = vec ! [ ] ; for child in & mut self . document . children { match child { DocumentChild :: Paragraph ( paragraph ) => { for child in & mut paragraph . children { if let ParagraphChild :: Run ( run ) = child { for child in & mut run . children { if let RunChild :: Drawing ( d ) = child { if let Some ( DrawingData :: Pic ( pic ) ) = & mut d . data { image_ids . push ( pic . id ) ; let b = std :: mem :: take ( & mut pic . image ) ; images . push ( ( pic . id , b ) ) ; } } } } } } DocumentChild :: Table ( table ) => { for TableChild :: TableRow ( row ) in & mut table . rows { for TableRowChild :: TableCell ( cell ) in & mut row . cells { for content in & mut cell . children { match content { TableCellContent :: Paragraph ( paragraph ) => { for child in & mut paragraph . children { if let ParagraphChild :: Run ( run ) = child { for child in & mut run . children { if let RunChild :: Drawing ( d ) = child { if let Some ( DrawingData :: Pic ( pic ) ) = & mut d . data { image_ids . push ( pic . id ) ; let b = std :: mem :: take ( & mut pic . image ) ; images . push ( ( pic . id , b ) ) ; } } } } } } TableCellContent :: Table ( _ ) => { // TODO: support comment } } } } } } _ => { } } } ( image_ids , images ) }
Traverse and collect images from document.
Traverse and collect images from document .
&mut self