summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-iotools
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-10-31 11:12:22 +0000
committerLibravatar GitHub <noreply@github.com>2023-10-31 11:12:22 +0000
commitce71a5a7902963538fc54583588850563f6746cc (patch)
tree3e869eba6d25d2db5fe81184ffee595e451b3147 /vendor/codeberg.org/gruf/go-iotools
parent[bugfix] Relax `Mention` parsing, allowing either href or name (#2320) (diff)
downloadgotosocial-ce71a5a7902963538fc54583588850563f6746cc.tar.xz
[feature] add per-uri dereferencer locks (#2291)
Diffstat (limited to 'vendor/codeberg.org/gruf/go-iotools')
-rw-r--r--vendor/codeberg.org/gruf/go-iotools/read.go8
-rw-r--r--vendor/codeberg.org/gruf/go-iotools/write.go8
2 files changed, 16 insertions, 0 deletions
diff --git a/vendor/codeberg.org/gruf/go-iotools/read.go b/vendor/codeberg.org/gruf/go-iotools/read.go
index 4a134e7b3..6ce2789a7 100644
--- a/vendor/codeberg.org/gruf/go-iotools/read.go
+++ b/vendor/codeberg.org/gruf/go-iotools/read.go
@@ -12,6 +12,14 @@ func (r ReaderFunc) Read(b []byte) (int, error) {
return r(b)
}
+// ReaderFromFunc is a function signature which allows
+// a function to implement the io.ReaderFrom type.
+type ReaderFromFunc func(io.Reader) (int64, error)
+
+func (rf ReaderFromFunc) ReadFrom(r io.Reader) (int64, error) {
+ return rf(r)
+}
+
// ReadCloser wraps an io.Reader and io.Closer in order to implement io.ReadCloser.
func ReadCloser(r io.Reader, c io.Closer) io.ReadCloser {
return &struct {
diff --git a/vendor/codeberg.org/gruf/go-iotools/write.go b/vendor/codeberg.org/gruf/go-iotools/write.go
index c520b8636..e1b44db24 100644
--- a/vendor/codeberg.org/gruf/go-iotools/write.go
+++ b/vendor/codeberg.org/gruf/go-iotools/write.go
@@ -10,6 +10,14 @@ func (w WriterFunc) Write(b []byte) (int, error) {
return w(b)
}
+// WriterToFunc is a function signature which allows
+// a function to implement the io.WriterTo type.
+type WriterToFunc func(io.Writer) (int64, error)
+
+func (wt WriterToFunc) WriteTo(r io.Writer) (int64, error) {
+ return wt(r)
+}
+
// WriteCloser wraps an io.Writer and io.Closer in order to implement io.WriteCloser.
func WriteCloser(w io.Writer, c io.Closer) io.WriteCloser {
return &struct {