# [−][src]Trait rayon::iter::plumbing::Consumer

    pub trait Consumer<Item>: Send + Sized {
        type Folder: Folder<Item, Result = Self::Result>;
        type Reducer: Reducer<Self::Result>;
        type Result: Send;
        fn split_at(self, index: usize) -> (Self, Self, Self::Reducer);
        fn into_folder(self) -> Self::Folder;
        fn full(&self) -> bool;
    }

A consumer is effectively a generalized "fold" operation, and in fact each consumer will eventually be converted into a `Folder`. What makes a consumer special is that, like a `Producer`, it can be split into multiple consumers using the `split_at` method. When a consumer is split, it produces two consumers, as well as a reducer. The two consumers can be fed items independently, and when they are done the reducer is used to combine their two results into one. See the `plumbing` README for further details.

## Associated Types

### `type Folder: Folder<Item, Result = Self::Result>`

The type of folder that this consumer can be converted into.

### `type Reducer: Reducer<Self::Result>`

The type of reducer that is produced if this consumer is split.

### `type Result: Send`

The type of result that this consumer will ultimately produce.

Loading content...

## Required methods

### `fn split_at(self, index: usize) -> (Self, Self, Self::Reducer)`

Divide the consumer into two consumers, one processing items `0..index` and one processing items from `index..`. Also produces a reducer that can be used to reduce the results at the end.

### `fn into_folder(self) -> Self::Folder`

Convert the consumer into a folder that can consume items sequentially, eventually producing a final result.

### `fn full(&self) -> bool`

Hint whether this `Consumer` would like to stop processing further items, e.g. if a search has been completed.

Loading content...

## Implementors

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)