Skip to content
This repository was archived by the owner on Oct 23, 2022. It is now read-only.

Commit a6728b5

Browse files
author
Joonas Koivunen
committed
fix: use latest walker api
1 parent 3dd7caf commit a6728b5

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

unixfs/src/symlink.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ mod tests {
140140
assert_eq!(*expected, fake.insert_v0(bytes).to_string());
141141
}
142142

143-
let mut walk = Some(Walker::new(
143+
let mut walker = Walker::new(
144144
// note: this matches the `symlinks_in_trees` root cid (the last cid produced)
145145
Cid::try_from(tree_blocks[0].0).unwrap(),
146146
String::default(),
147-
));
147+
);
148148

149149
#[derive(Debug, PartialEq, Eq)]
150150
enum Entry {
@@ -155,25 +155,24 @@ mod tests {
155155

156156
let mut actual = Vec::new();
157157

158-
while let Some(walker) = walk {
158+
while walker.should_continue() {
159159
let (next, _) = walker.pending_links();
160160
let next = fake.get_by_cid(next);
161161

162-
walk = match walker.continue_walk(next, &mut None).unwrap() {
163-
ContinuedWalk::File(_, it) => {
164-
actual.push(Entry::File(it.as_entry().path().into()));
165-
it.into_inner()
162+
match walker.next(next, &mut None).unwrap() {
163+
ContinuedWalk::File(_fs, _cid, path, _metadata, _total_size) => {
164+
actual.push(Entry::File(path.into()));
166165
}
167-
ContinuedWalk::Directory(it) => {
168-
actual.push(Entry::Dir(it.as_entry().path().into()));
169-
it.into_inner()
166+
ContinuedWalk::RootDirectory(_cid, path, _metadata)
167+
| ContinuedWalk::Directory(_cid, path, _metadata) => {
168+
actual.push(Entry::Dir(path.into()));
170169
}
171-
ContinuedWalk::Symlink(link_name, it) => {
170+
ContinuedWalk::Bucket(..) => { /* ignore */ }
171+
ContinuedWalk::Symlink(link_name, _cid, path, _metadata) => {
172172
actual.push(Entry::Symlink(
173-
it.as_entry().path().into(),
173+
path.into(),
174174
std::str::from_utf8(link_name).unwrap().to_owned(),
175175
));
176-
it.into_inner()
177176
}
178177
};
179178
}

0 commit comments

Comments
 (0)