Impl forward of &mut T to T for TarEntriesVisitor

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-11 20:35:02 +10:00
parent 90a96cabc9
commit 4892d8bf3a
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -15,6 +15,12 @@ pub trait TarEntriesVisitor {
fn visit<R: Read>(&mut self, entries: Entries<'_, R>) -> Result<(), BinstallError>;
}
impl<V: TarEntriesVisitor> TarEntriesVisitor for &mut V {
fn visit<R: Read>(&mut self, entries: Entries<'_, R>) -> Result<(), BinstallError> {
(*self).visit(entries)
}
}
/// * `f` - If Some, then this function will pass
/// the entries of the `dat` to it and let it decides
/// what to do with the tar.