pub(crate) mod attribute; pub(crate) mod dot; pub(crate) mod record; pub(crate) mod pattern; pub(crate) mod fn_param; pub(crate) mod keyword; pub(crate) mod snippet; pub(crate) mod qualified_path; pub(crate) mod unqualified_path; pub(crate) mod postfix; pub(crate) mod macro_in_item_position; pub(crate) mod trait_impl; pub(crate) mod mod_; use crate::item::{Builder, CompletionItem}; /// Represents an in-progress set of completions being built. #[derive(Debug, Default)] pub struct Completions { buf: Vec, } impl Completions { pub fn add(&mut self, item: CompletionItem) { self.buf.push(item.into()) } pub fn add_all(&mut self, items: I) where I: IntoIterator, I::Item: Into, { items.into_iter().for_each(|item| self.add(item.into())) } } impl Into> for Completions { fn into(self) -> Vec { self.buf } } impl Builder { /// Convenience method, which allows to add a freshly created completion into accumulator /// without binding it to the variable. pub(crate) fn add_to(self, acc: &mut Completions) { acc.add(self.build()) } }