summaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/a-h/templ/runtime/bufferpool.go
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-09-13 13:01:48 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-09-13 13:01:48 +0200
commit548090e67f66acf84385c4152ca464e52d3e3319 (patch)
tree9b6de528bd7b0aa63362fa83f5c8e6a97f68a5d8 /vendor/github.com/a-h/templ/runtime/bufferpool.go
parenta1d809960bee74df19c7e5fc34ffd1e4757cfdcb (diff)
Migrate away from templ and towards html/template
Diffstat (limited to 'vendor/github.com/a-h/templ/runtime/bufferpool.go')
-rw-r--r--vendor/github.com/a-h/templ/runtime/bufferpool.go38
1 files changed, 0 insertions, 38 deletions
diff --git a/vendor/github.com/a-h/templ/runtime/bufferpool.go b/vendor/github.com/a-h/templ/runtime/bufferpool.go
deleted file mode 100644
index ca2a131..0000000
--- a/vendor/github.com/a-h/templ/runtime/bufferpool.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package runtime
-
-import (
- "io"
- "sync"
-)
-
-var bufferPool = sync.Pool{
- New: func() any {
- return new(Buffer)
- },
-}
-
-// GetBuffer creates and returns a new buffer if the writer is not already a buffer,
-// or returns the existing buffer if it is.
-func GetBuffer(w io.Writer) (b *Buffer, existing bool) {
- if w == nil {
- return nil, false
- }
- b, ok := w.(*Buffer)
- if ok {
- return b, true
- }
- b = bufferPool.Get().(*Buffer)
- b.Reset(w)
- return b, false
-}
-
-// ReleaseBuffer flushes the buffer and returns it to the pool.
-func ReleaseBuffer(w io.Writer) (err error) {
- b, ok := w.(*Buffer)
- if !ok {
- return nil
- }
- err = b.Flush()
- bufferPool.Put(b)
- return err
-}