summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-iotools/size.go
blob: f3841facf7520e5a644c3d69798f3e47b291a130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package iotools

type Sizer interface {
	Size() int64
}

// SizerFunc is a function signature which allows
// a function to implement the Sizer type.
type SizerFunc func() int64

func (s SizerFunc) Size() int64 {
	return s()
}

type Lengther interface {
	Len() int
}

// LengthFunc is a function signature which allows
// a function to implement the Lengther type.
type LengthFunc func() int

func (l LengthFunc) Len() int {
	return l()
}