[][src]Crate generator_extensions

generator_extensions provides a set of blanket-implemented traits which provide parity between Generators and Iterators.

To take advantage of the blanket implementations, simply write the following, which imports all of the extension traits into the current scope:

use generator_extensions::prelude::*;

The two extension traits provided by generator_extensions are Resumable, which represents a resumable reference to a Generator, and IntoGenerator which represents a type which can be converted into a Generator.

The Resumable trait provides extension methods to unify Resumable and Unpin generators, transform the outputs of generators, and convert certain types of generators into Iterators.

The IntoGenerator trait permits conversion of Iterators into Generators. Due to the way built-in generator types are expressed by the Rust compiler, the Gen newtype wrapper is provided to allow compiler-generated and external generator types to interoperate with IntoGenerator.

License

generator_extensions is licensed under the terms of the Apache License, Version 2.0 or the MIT License.

Development

generator_extensions is developed at GitLab.

Modules

prelude

The generator_extensions prelude.

Structs

Fuse

The return type of Resumable::fuse.

Gen

A newtype wrapper for built-in generators which provides an implementation of the IntoGenerator trait.

GenIter

An Iterator wrapped to expose a Generator implementation which yields the iterator's Item type and then returns ().

Iter

The return type of Resumable::iter.

States

The return type of Resumable::states.

Unify

The return type of Resumable::unify.

Enums

GeneratorStateExperimental

The result of a generator resumption.

Traits

GeneratorExperimental

The trait implemented by builtin generator types.

IntoGenerator

This trait represents a value which can be transformed into a Generator.

Resumable

This trait provides extension methods for generators behind references which allow resumption.