Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
Add walker func (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
domenipavec authored and xor-gate committed Aug 20, 2017
1 parent f00bf38 commit 429ded3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions exif/exif.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,14 @@ type Walker interface {
Walk(name FieldName, tag *tiff.Tag) error
}

// WalkerFunc is an adapter to allow the use of ordinary functions for Walk.
type WalkerFunc func(name FieldName, tag *tiff.Tag) error

// Walk calls f(name, tag)
func (f WalkerFunc) Walk(name FieldName, tag *tiff.Tag) error {
return f(name, tag)
}

// Walk calls the Walk method of w with the name and tag for every non-nil
// EXIF field. If w aborts the walk with an error, that error is returned.
func (x *Exif) Walk(w Walker) error {
Expand Down

0 comments on commit 429ded3

Please sign in to comment.