pub struct Errors {
    pub errors: Vec<Error>,
    /* private fields */
}
Expand description

A collection of errors from attempting to compile some ISLE source files.

Fields§

§errors: Vec<Error>

The individual errors.

Implementations§

Create isle::Errors from the given I/O error and context.

Examples found in repository?
src/lexer.rs (line 103)
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
    pub fn from_files<P>(file_paths: impl IntoIterator<Item = P>) -> Result<Lexer<'a>>
    where
        P: AsRef<Path>,
    {
        let mut filenames = Vec::<Arc<str>>::new();
        let mut file_texts = Vec::<Arc<str>>::new();

        for f in file_paths {
            let f = f.as_ref();

            filenames.push(f.display().to_string().into());

            let s = std::fs::read_to_string(f)
                .map_err(|e| Errors::from_io(e, format!("failed to read file: {}", f.display())))?;
            file_texts.push(s.into());
        }

        assert!(!filenames.is_empty());

        let mut file_starts = vec![];
        let mut buf = String::new();
        for text in &file_texts {
            file_starts.push(buf.len());
            buf += &text;
            buf += "\n";
        }

        let mut l = Lexer {
            filenames,
            file_texts,
            buf: Cow::Owned(buf.into_bytes()),
            file_starts,
            pos: Pos {
                file: 0,
                offset: 0,
                line: 1,
                col: 0,
            },
            lookahead: None,
        };
        l.reload()?;
        Ok(l)
    }

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.