Documentation ¶
Overview ¶
Package record provides Record
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
Record is an object that keeps track of recorded values. It is safe for concurrent access, the zero value is ready to use.
Re-use of the Record is possible (using the Reset method), however the implementation is internally optimized when writes happen only once.
A Record must not be copied after first use.
Example ¶
r := Record{} // record a value using the Record() method fmt.Println(r.Record("first")) fmt.Println(r.Record("first")) // check if a value has been recorded using .Recorded() fmt.Println(r.Recorded("second")) r.Record("second") fmt.Println(r.Recorded("second")) // Reset all recorded values using .Reset() r.Reset() fmt.Println(r.Recorded("first")) fmt.Println(r.Recorded("second"))
Output: false true false true false false
func (*Record) Record ¶
Record records and marks the value v as having been visited.
When value has been recorded before, returns a true. Otherwise returns false.
Record is an atomic operation and can be safely called concurrently.
Click to show internal directories.
Click to hide internal directories.