gir_format_check/
errors.rs

1// Copyright 2013-2018, The Gtk-rs Project Developers.
2// See the COPYRIGHT file at the top-level directory of this distribution.
3// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4
5use std::fmt;
6
7pub struct Errors {
8    pub messages: Vec<String>,
9    pub nb_errors: usize,
10}
11
12impl Errors {
13    pub fn has_errors(&self) -> bool {
14        self.nb_errors > 0
15    }
16}
17
18impl fmt::Display for Errors {
19    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20        f.write_str(&self.messages.join("\n"))
21    }
22}