You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ntool/nsys/cmdn/options.go

50 lines
1.0 KiB
Go

package cmdn
import (
"git.noahlan.cn/noahlan/ntool/ndef"
"time"
)
func WithSerializer(serializer ndef.Serializer) Option {
return func(opt *Options) {
opt.Marshaler = &ndef.MarshalerWrapper{Marshaler: serializer}
opt.Unmarshaler = &ndef.UnmarshalerWrapper{Unmarshaler: serializer}
}
}
func WithMarshaler(marshaler ndef.Marshaler) Option {
return func(opt *Options) {
opt.Marshaler = marshaler
}
}
func WithUnmarshaler(unmarshaler ndef.Unmarshaler) Option {
return func(opt *Options) {
opt.Unmarshaler = unmarshaler
}
}
func WithStartupDecidedFunc(startupDecidedFunc LineFunc) Option {
return func(opt *Options) {
opt.StartupDecidedFunc = startupDecidedFunc
}
}
func WithEndLineDecidedFunc(endLineDecidedFunc LineFunc) Option {
return func(opt *Options) {
opt.EndLineDecidedFunc = endLineDecidedFunc
}
}
func WithReadIDFunc(readIDFunc ReadIDFunc) Option {
return func(opt *Options) {
opt.ReadIDFunc = readIDFunc
}
}
func WithTimeout(timeout time.Duration) Option {
return func(opt *Options) {
opt.Timeout = timeout
}
}