-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttons_string.go
42 lines (34 loc) · 1017 Bytes
/
buttons_string.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Code generated by "stringer -type=Buttons"; DO NOT EDIT.
package mouse
import (
"errors"
"strconv"
)
var _ = errors.New("dummy error")
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[NoButton-0]
_ = x[Left-1]
_ = x[Middle-2]
_ = x[Right-3]
_ = x[ButtonsN-4]
}
const _Buttons_name = "NoButtonLeftMiddleRightButtonsN"
var _Buttons_index = [...]uint8{0, 8, 12, 18, 23, 31}
func (i Buttons) String() string {
if i < 0 || i >= Buttons(len(_Buttons_index)-1) {
return "Buttons(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _Buttons_name[_Buttons_index[i]:_Buttons_index[i+1]]
}
func (i *Buttons) FromString(s string) error {
for j := 0; j < len(_Buttons_index)-1; j++ {
if s == _Buttons_name[_Buttons_index[j]:_Buttons_index[j+1]] {
*i = Buttons(j)
return nil
}
}
return errors.New("String: " + s + " is not a valid option for type: Buttons")
}