Skip to content

Instantly share code, notes, and snippets.

/// Gets the missing content of the record.
pub fn missing_content(&self) -> impl Iterator<Item = (&AnyHash, &MissingContent)> {
match &self.state {
PackageRecordState::Sourcing {
missing_content, ..
} => Box::new(missing_content.iter()) as Box<dyn Iterator<Item = _>>,
_ => Box::new(std::iter::empty()) as Box<dyn Iterator<Item = _>>,
}
}
// Example generated bindings
mod bindings {
pub trait Host {
fn host_func(&mut self);
}
pub trait GetHost<T>: Send + Sync + 'static {
fn get_host<'a>(&self, data: &'a mut T) -> impl Host;
}