Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidTotal = errors.New("invalid total")
Functions ¶
This section is empty.
Types ¶
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
A thread-safe progress tracker; reports percentages exactly (i.e. greater than '1.0' is possible), but will panic on denominators <= '0'.
NOTE: A 'Progress' struct must not be copied after first use.
func NewWithTotal ¶
Creates a new 'Progress' struct with the specified 'total' size.
func (*Progress) Add ¶
Adds the specified amount to the current progress and returns the new 'current' value. This method is thread-safe.
func (*Progress) Current ¶
Return the 'current' value for the 'Progress' struct. This method is thread-safe.
func (*Progress) Percentage ¶
Retrieves the current progress as a decimal fraction. This method is thread-safe.
NOTE: This method returns '0.0' if the underlying total is unset.
func (*Progress) Reset ¶
func (p *Progress) Reset()
Resets the current progress to '0'. This method is thread-safe.
NOTE: This method does *NOT* modify the 'total' value.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
A thread-safe 'io.Writer' implementation that tracks the percentage of bytes written against a specified total.