mirror of
https://github.com/fossabot/clash.git
synced 2025-09-27 05:08:29 +08:00
19 lines
318 B
Go
19 lines
318 B
Go
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")
|
|
}
|
|
}
|