// Code generated by mygo generate from the interfaces of the native module. DO NOT EDIT. // mygo:native 3 49247f7c2dec49eb package uses import ( _filepath "path/filepath" _runtime "runtime" _native "github.com/egoist/mygo/native" "github.com/egoist/mygo/native/internal/roundtrip" ) // _module describes the module to the runtime. var _module = &_native.Module{Name: "Uses", Symbol: "uses", Langs: []string{"swift"}, SwiftOS: []string{"macos"}, MinMacOS: "13", MinIOS: "", Kotlin: "", Dir: _dir(), Errors: []*_native.Error{}, Deps: []string{"Roundtrip"}} // _dir returns the package's directory when the binary knows it, where // mygo dev builds the implementation for go test and go run. func _dir() string { _, file, _, ok := _runtime.Caller(0) if !ok || !_filepath.IsAbs(file) { return "" } return _filepath.Dir(file) } func init() { _native.Register(_module, map[string]_native.Wrapper{ "Mixer": {Flags: 0, Wrap: func(o *_native.Object) any { return &_Mixer{o} }}, }) } // NewMixer makes the implementation of Mixer on this platform. It returns // errors.ErrUnsupported where the module has none, or the system lacks // what it needs. func NewMixer() (Mixer, error) { o, err := _module.New("Mixer", 0) if err != nil { return nil, err } return &_Mixer{o}, nil } // _Mixer calls the platform's implementation of Mixer. type _Mixer struct{ o *_native.Object } // NativeObject returns the platform's object. func (x *_Mixer) NativeObject() *_native.Object { return x.o } // _wrapMixer wraps a handle of the platform's, or returns nil. func _wrapMixer(h uint64) Mixer { if h == 0 { return nil } return &_Mixer{_module.Object(h, 0)} } func (_x *_Mixer) Pair(p Pair) (Pair, error) { _e := _native.NewEncoder() _enc_Pair(_e, p) var _r Pair _d, _err := _x.NativeObject().Call("Mixer_Pair", 0, _e) if _err == nil { _r = _dec_Pair(_d) _err = _d.Close() } return _r, _err } func (_x *_Mixer) Kinds(rs []roundtrip.Record) []roundtrip.Kind { _e := _native.NewEncoder() _enc_slice_Roundtrip_Record(_e, rs) var _r []roundtrip.Kind _d, _err := _x.NativeObject().Call("Mixer_Kinds", 0, _e) if _err == nil { _r = _dec_slice_Roundtrip_Kind(_d) _err = _d.Close() } _ = _err return _r } func (_x *_Mixer) Next(c roundtrip.Counter) int { defer _runtime.KeepAlive(c) _e := _native.NewEncoder() _e.Uint(_native.HandleOf(c)) var _r int _d, _err := _x.NativeObject().Call("Mixer_Next", 0, _e) if _err == nil { _r = int(_d.Int()) _err = _d.Close() } _ = _err return _r } func _enc_Pair(_e *_native.Encoder, _v Pair) { _enc_Roundtrip_Record(_e, _v.R) _enc_ptr_Roundtrip_Inner(_e, _v.Inner) _e.Int(int64(_v.N)) } func _dec_Pair(_d *_native.Decoder) Pair { return Pair{ R: _dec_Roundtrip_Record(_d), Inner: _dec_ptr_Roundtrip_Inner(_d), N: int(_d.Int()), } } func _enc_Roundtrip_Inner(_e *_native.Encoder, _v roundtrip.Inner) { _e.Float(float64(_v.X)) _e.Float(float64(_v.Y)) } func _dec_Roundtrip_Inner(_d *_native.Decoder) roundtrip.Inner { return roundtrip.Inner{ X: float64(_d.Float()), Y: float64(_d.Float()), } } func _enc_Roundtrip_Kind(_e *_native.Encoder, _v roundtrip.Kind) { _e.String(string(_v)) } func _dec_Roundtrip_Kind(_d *_native.Decoder) roundtrip.Kind { return roundtrip.Kind(_d.String()) } func _enc_Roundtrip_Record(_e *_native.Encoder, _v roundtrip.Record) { _e.String(_v.Name) _enc_slice_int(_e, _v.Counts) _enc_map_string(_e, _v.Tags) _enc_Roundtrip_Inner(_e, _v.Inner) _enc_ptr_Roundtrip_Inner(_e, _v.Next) _enc_Roundtrip_Kind(_e, _v.Kind) _e.Bytes(_v.Data) } func _dec_Roundtrip_Record(_d *_native.Decoder) roundtrip.Record { return roundtrip.Record{ Name: _d.String(), Counts: _dec_slice_int(_d), Tags: _dec_map_string(_d), Inner: _dec_Roundtrip_Inner(_d), Next: _dec_ptr_Roundtrip_Inner(_d), Kind: _dec_Roundtrip_Kind(_d), Data: _d.Bytes(), } } func _enc_map_string(_e *_native.Encoder, _v map[string]string) { _e.Len(len(_v)) for _k, _x := range _v { _e.String(_k) _e.String(_x) } } func _dec_map_string(_d *_native.Decoder) map[string]string { _n := _d.Len() if _n == 0 { return nil } _v := make(map[string]string, _n) for range _n { _k := _d.String() _v[_k] = _d.String() } return _v } func _enc_ptr_Roundtrip_Inner(_e *_native.Encoder, _v *roundtrip.Inner) { if _v == nil { _e.Bool(false) return } _e.Bool(true) _enc_Roundtrip_Inner(_e, *_v) } func _dec_ptr_Roundtrip_Inner(_d *_native.Decoder) *roundtrip.Inner { if !_d.Bool() { return nil } _x := _dec_Roundtrip_Inner(_d) return &_x } func _enc_slice_Roundtrip_Kind(_e *_native.Encoder, _v []roundtrip.Kind) { _e.Len(len(_v)) for _, _x := range _v { _enc_Roundtrip_Kind(_e, _x) } } func _dec_slice_Roundtrip_Kind(_d *_native.Decoder) []roundtrip.Kind { _n := _d.Len() if _n == 0 { return nil } _v := make([]roundtrip.Kind, _n) for _i := range _v { _v[_i] = _dec_Roundtrip_Kind(_d) } return _v } func _enc_slice_Roundtrip_Record(_e *_native.Encoder, _v []roundtrip.Record) { _e.Len(len(_v)) for _, _x := range _v { _enc_Roundtrip_Record(_e, _x) } } func _dec_slice_Roundtrip_Record(_d *_native.Decoder) []roundtrip.Record { _n := _d.Len() if _n == 0 { return nil } _v := make([]roundtrip.Record, _n) for _i := range _v { _v[_i] = _dec_Roundtrip_Record(_d) } return _v } func _enc_slice_int(_e *_native.Encoder, _v []int) { _e.Len(len(_v)) for _, _x := range _v { _e.Int(int64(_x)) } } func _dec_slice_int(_d *_native.Decoder) []int { _n := _d.Len() if _n == 0 { return nil } _v := make([]int, _n) for _i := range _v { _v[_i] = int(_d.Int()) } return _v }