Skip to main content

empty

Function empty 

Source
pub fn empty<T: Flat>() -> impl Emit<NearList<T>>
Expand description

Returns an empty iterator suitable for any NearList<T> emitter parameter.

Since Infallible implements Emit<T> for all T: Flat, an Empty<Infallible> satisfies any IntoIterator<Item: Emit<T>> bound.

ยงExamples

use nearest::{Flat, NearList, Region, empty};

#[derive(Flat)]
struct Root { items: NearList<u32> }

// Use empty() when building a struct with an empty NearList.
let region = Region::new(Root::make(empty()));
assert!(region.items.is_empty());