clash/observable/iterable.go

19 lines
318 B
Go
Raw Normal View History

2018-06-10 14:50:03 +00:00
package observable
import (
"errors"
)
type Iterable <-chan interface{}
func NewIterable(any interface{}) (Iterable, error) {
switch any := any.(type) {
case chan interface{}:
return Iterable(any), nil
case <-chan interface{}:
return Iterable(any), nil
default:
return nil, errors.New("type error")
}
}