mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-08 16:04:41 +00:00
19 lines
234 B
Go
19 lines
234 B
Go
package moreatomic
|
|
|
|
import "sync/atomic"
|
|
|
|
type String struct {
|
|
v atomic.Value
|
|
}
|
|
|
|
func (s *String) Get() string {
|
|
if v, ok := s.v.Load().(string); ok {
|
|
return v
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (s *String) Set(str string) {
|
|
s.v.Store(str)
|
|
}
|