1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use debcontrol::{Field, Paragraph}; pub fn paragraph_contains(paragraph: Paragraph, query: String) -> Option<Field> { let mut field = None; let results: Vec<Field> = paragraph .fields .into_iter() .filter(|f| f.name == query) .collect(); if !results.is_empty() { field = Some(results[0].clone()); } field }