Method
require_n
(reader: &mut BlockReader, count: usize, extractor: U)
Source from the content-addressed store, hash-verified
| 849 | } |
| 850 | |
| 851 | fn require_n<T, U>(reader: &mut BlockReader, count: usize, extractor: U) -> Result<T, Error> where U: Fn(BlockReader) -> T { |
| 852 | match reader.read_n(count) { |
| 853 | Ok(bytes) => { |
| 854 | let mut cursor = Cursor::new(bytes); |
| 855 | let r = BlockReader::new(&mut cursor); |
| 856 | |
| 857 | Ok(extractor(r)) |
| 858 | }, |
| 859 | Err(err) => Err(err) |
| 860 | } |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | // TODO remove pub after testing |
Callers
nothing calls this directly
Tested by
no test coverage detected