[wip] Committing before starting over

Committing before duplicating the file and rewriting
it line by line with more careful attention to the
borrow checker.
This commit is contained in:
Adam Cooper 2022-02-16 09:17:43 -05:00
parent 06e60dce14
commit 2298b04eec

View file

@ -133,9 +133,9 @@ async fn traverse(mut result: Multistatus) {
let mut already_visited: bool; let mut already_visited: bool;
// Initialize the hashmap of visited items (by etag?) // Initialize the hashmap of visited items (by etag?)
let mut visited_items = HashMap::new(); let mut visited_items = HashMap::new();
// match result.response[0].propstat[0].prop { /*
match &result.response.into_iter().nth(0).unwrap() match result.response[0].propstat[0].prop {
.propstat.into_iter().nth(0).unwrap().prop { // match result.response.get(0).unwrap().propstat.get(0).unwrap().prop {
Some(prop) => match prop.get_etag { Some(prop) => match prop.get_etag {
Some(etag) => { Some(etag) => {
visited_items.insert(etag, true); visited_items.insert(etag, true);
@ -145,8 +145,19 @@ async fn traverse(mut result: Multistatus) {
}, },
_ => current_index += 1, _ => current_index += 1,
} }
*/
if let Some(prop) = &result.response[0].propstat[0].prop {
if let Some(etag) = &prop.get_etag {
visited_items.insert(etag, true);
} else {
current_index += 1;
}
} else {
current_index += 1;
}
// Depth first traversal // Depth first traversal
while !result.response.is_empty() { while current_index < &result.response.len() {
match &result.response[current_index].propstat[0].prop { match &result.response[current_index].propstat[0].prop {
Some(prop) => { Some(prop) => {
match prop.get_etag { match prop.get_etag {