Traverse the file tree #1

Closed
opened 2021-12-12 00:17:35 +00:00 by adam · 9 comments
adam commented 2021-12-12 00:17:35 +00:00 (Migrated from git.theadamcooper.com)

This is the actual first item: log out the file tree. We can bake in the auth here, and break it out later.

Libraries we'll need:

  • XML parser
  • HTTP
  • Logging
This is the actual first item: log out the file tree. We can bake in the auth here, and break it out later. Libraries we'll need: - XML parser - HTTP - Logging
adam commented 2022-01-09 17:10:38 +00:00 (Migrated from git.theadamcooper.com)
Sketch | Iteration
  • Pass (copy of?) response vector into function as queue.
  • While queue is not empty:
    • take first item from queue.
      • if it's a collection, get its children and append them to queue
      • if not, publicise it!
##### Sketch | Iteration - Pass (copy of?) response vector into function as queue. - While queue is not empty: - take first item from queue. - if it's a collection, get its children and append them to queue - if not, publicise it!
adam commented 2022-01-17 04:45:08 +00:00 (Migrated from git.theadamcooper.com)
Handling the Option

In the loop, we need to advance the loop counter every time, the question is whether we do anything else. If we encounter a None, we should be able to ignore it & move on, but I'm not sure how to implement that.

##### Handling the Option In the loop, we need to advance the loop counter every time, the question is whether we do anything else. If we encounter a `None`, we should be able to ignore it & move on, but I'm not sure how to implement that.
adam commented 2022-01-21 15:06:34 +00:00 (Migrated from git.theadamcooper.com)
Fixing incompatible match arms

Theyre just that: incompatible. An assignment statement returns the unit type (). A hash map insertion returns Option(V). So the latter needs to be inside a block that returns the unit type. The block can go on one line.

##### Fixing incompatible match arms Theyre just that: incompatible. An assignment statement returns the unit type `()`. A hash map insertion returns `Option(V)`. So the latter needs to be inside a block that returns the unit type. The block _can_ go on one line.
adam commented 2022-01-30 13:09:57 +00:00 (Migrated from git.theadamcooper.com)

Great blog post on matching structs.

Great [blog post](https://blog.rust-lang.org/2015/04/17/Enums-match-mutation-and-moves.html) on matching structs.
adam commented 2022-02-15 03:02:32 +00:00 (Migrated from git.theadamcooper.com)

You cant mutably borrow something after youve immutably borrowed it. Try mut Vec declaration again.

You cant mutably borrow something after youve immutably borrowed it. Try `mut Vec` declaration again.
adam commented 2022-02-16 01:31:27 +00:00 (Migrated from git.theadamcooper.com)

Maybe try taking out the Options, just to simplify the code. That should eliminate the immutable borrowings in match arms

Maybe try taking out the `Options`, just to simplify the code. That should eliminate the immutable borrowings in `match` arms
adam commented 2022-02-16 02:03:13 +00:00 (Migrated from git.theadamcooper.com)

Also do I have to call functions from traverse to handle immutable borrowings? and leave traverse purely mutable?

Also do I have to call functions from `traverse` to handle immutable borrowings? and leave `traverse` purely mutable?
adam commented 2022-03-06 23:28:12 +00:00 (Migrated from git.theadamcooper.com)

// A sketch on munging the href
fn main() {
    println!("Hello, world!");
    let username = "adam";
    let href = "/nextcloud/remote.php/dav/files/adam/public/2014_public/";
    // Search for username and lop.
    let username_seg_string = format!("/{}/", username);
    let username_seg = username_seg_string.as_str();
    let index = href.find(username_seg).unwrap_or(0);
    let new_index = index + username.len() + 2;
    let new_href = &href[new_index..];
    println!("new_href: {}", new_href);
}
```rust // A sketch on munging the href fn main() { println!("Hello, world!"); let username = "adam"; let href = "/nextcloud/remote.php/dav/files/adam/public/2014_public/"; // Search for username and lop. let username_seg_string = format!("/{}/", username); let username_seg = username_seg_string.as_str(); let index = href.find(username_seg).unwrap_or(0); let new_index = index + username.len() + 2; let new_href = &href[new_index..]; println!("new_href: {}", new_href); } ```
adam commented 2022-03-07 08:53:32 +00:00 (Migrated from git.theadamcooper.com)

I've misunderstood ETags. The ETag of the first folder (test_public) is the same as that of its last item (2021_test_public), so the latter is not visited.

Logs of a recent run are in the scratchpad folder.

ETag is more like a timestamp.

Use href or clone of it.

I've misunderstood ETags. The ETag of the first folder (test_public) is the same as that of its last item (2021_test_public), so the latter is not visited. Logs of a recent run are in the scratchpad folder. ETag is more like a timestamp. Use href or clone of it.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: adam/publicise-rs#1
No description provided.