-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.go
More file actions
57 lines (43 loc) · 1.26 KB
/
options.go
File metadata and controls
57 lines (43 loc) · 1.26 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package gcode
import "github.com/lestrrat-go/option/v3"
// ReadOption configures a [Reader].
type ReadOption interface {
option.Interface
readOption()
}
// WriteOption configures a [Writer].
type WriteOption interface {
option.Interface
writeOption()
}
// Option satisfies both ReadOption and WriteOption.
type Option interface {
ReadOption
WriteOption
}
type readOption struct{ option.Interface }
func (*readOption) readOption() {}
type writeOption struct{ option.Interface }
func (*writeOption) writeOption() {}
type sharedOption struct{ option.Interface }
func (*sharedOption) readOption() {}
func (*sharedOption) writeOption() {}
type identDialect struct{}
type identStrict struct{}
type identEmitComments struct{}
type identEmitLineNumbers struct{}
type identComputeChecksum struct{}
type identLineEnding struct{}
type identMaxLineSize struct{}
// WithDialect attaches a [Dialect] to a Reader or Writer.
func WithDialect(d *Dialect) Option {
return &sharedOption{option.New(identDialect{}, d)}
}
// LineEnding selects the line ending style emitted by a [Writer].
type LineEnding int
const (
// LineEndingLF uses a single line feed character.
LineEndingLF LineEnding = iota
// LineEndingCRLF uses a carriage return followed by a line feed.
LineEndingCRLF
)