NativeIterable.hx 714 B

1234567891011121314151617181920
  1. package python;
  2. import python.HaxeIterable;
  3. import python.NativeIterator;
  4. abstract NativeIterable <T>(NativeIterableRaw<T>) to NativeIterableRaw<T> from NativeIterableRaw<T> {
  5. @:to public static inline function toHaxeIterable <T>(p:NativeIterableRaw<T>):HaxeIterable<T> return new HaxeIterable(p);
  6. //@:from public static inline function fromArray <T>(p:Array<T>):PyIterable<T> return cast p;
  7. public inline function iterator <T>() return toHaxeIterable().iterator();
  8. public function getNativeIterable <T>():NativeIterableRaw<T> return this;
  9. public function getNativeIterator <T>():NativeIteratorRaw<T> return this.__iter__();
  10. }
  11. typedef NativeIterableRaw<T> = {
  12. function __iter__():NativeIterator<T>;
  13. }