Skip to main content

split

Function split 

Source
pub fn split(
    selections: &[FieldSelection],
    data: &mut Value,
    variables: &HashMap<String, Value>,
    batch_size: usize,
) -> Result<Vec<StreamedChunk>, NotStreamable>
Expand description

Split every @stream-marked nested list in data into its initial slice and its continuation chunks.

selections must be the effective selection set — spreads expanded and @skip/@include applied — so a field the client never asked for cannot be streamed into existence. data is mutated in place: each streamed list is truncated to its initialCount, and the removed tail becomes the returned chunks, in document order.

batch_size is the maximum items per chunk and must be at least 1; 0 is treated as 1 rather than producing an infinite number of empty chunks.

§Errors

Returns NotStreamable if a @stream marks a field that resolved to something other than a list.