Documentation ¶
Overview ¶
Package util contains internal routines used by the styx packages.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlackHole ¶
type BlackHole struct{}
A BlackHole is an io.ReadWriteCloser that accepts an infinite amount of input and produces no output.
type RefCount ¶
type RefCount struct {
// contains filtered or unexported fields
}
A Refcount can be embedded in structures to provide reference-counting of resources.
Example ¶
package main import "aqwari.net/net/styx/internal/util" type Session struct { util.RefCount User, Tree string Requests chan []byte } func (s *Session) end() { select { case <-s.Requests: return } } func main() { s := &Session{Requests: make(chan []byte)} for i := 0; i < 10; i++ { s.IncRef() } for i := 0; i < 20; i++ { if !s.DecRef() { s.end() break } } }
Output:
type SectionWriter ¶
type SectionWriter struct {
// contains filtered or unexported fields
}
Section writer provides a partial analogue io.SectionReader, for writers.
func NewSectionWriter ¶
func NewSectionWriter(w io.WriterAt, off, n int64) *SectionWriter
Click to show internal directories.
Click to hide internal directories.