compose_library/
sink.rs

1use std::fmt::Debug;
2use ecow::EcoVec;
3use crate::diag::SourceDiagnostic;
4
5#[derive(Default, Debug)]
6pub struct Sink {
7    pub warnings: EcoVec<SourceDiagnostic>,
8}
9
10impl Sink {
11    pub(crate) fn warn(&mut self, warning: SourceDiagnostic) {
12        self.warnings.push(warning);
13    }
14    
15    pub fn take_warnings(&mut self) -> EcoVec<SourceDiagnostic> {
16        std::mem::take(&mut self.warnings)
17    }
18}