mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-12-01 03:03:48 +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)
|
||
|
}
|