History

Looks like the functional approach to locate(…) doesn't borrowcheck

Sebastian Thiel committed 6 years ago

Commit 5df68671 parent 9e68c6b1 file · +10 −2Browse files

Unified · Split

git-odb/src/compound.rs+10−2
@@ -32,8 +32,16 @@ mod locate { · 31 unmodified lines
32 }32 }
33 33
34 impl compound::Db {34 impl compound::Db {
35 pub fn locate<'a>(&self, _id: borrowed::Id, _buffer: &'a mut Vec<u8>) -> Option<Result<Object<'a>, Error>> {35 pub fn locate<'a>(&self, id: borrowed::Id, buffer: &'a mut Vec<u8>) -> Option<Result<Object<'a>, Error>> {
36 unimplemented!("object location")36 if let Some(object) = self
37 .packs
38 .iter()
39 .find_map(|pack| pack.locate(id, buffer, &mut pack::cache::DecodeEntryNoop))
40 {
41 Some(object.map(|object| Object::Borrowed(object)).map_err(Into::into))
42 } else {
43 unimplemented!("object location")
44 }
37 }45 }
38 }46 }
39}47}