1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//!
//! COM library parse model.
//!
//! Defines the items constructed from the various COM attributes.
//!
//! Should unify COM attribute expansion and crate parsing for IDL/Manifest/etc.
//! purposes in the future.
//!

#[derive(Fail, Debug)]
#[non_exhaustive]
pub enum ParseError {
    #[fail( display = "Parsing [com_library] failed: {}", _0 )]
    ComLibrary( String ),

    #[fail( display = "Parsing [com_class] item {} failed: {}", _0, _1 )]
    ComStruct( String, String ),

    #[fail( display = "Parsing [com_interface] item {} failed: {}", _0, _1 )]
    ComInterface( String, String ),

    #[fail( display = "Parsing [com_impl] {} for {} failed: {}", _0, _1, _2 )]
    ComImpl( String, String, String ),

    #[fail( display = "Processing crate failed: {}", _0 )]
    ComCrate( String ),

    #[fail( display = "Reading TOML failed: {}", _0 )]
    CargoToml( String ),
}

pub type ParseResult<T> = Result<T, ParseError>;

#[macro_use]
mod macros;

mod comlibrary; pub use self::comlibrary::*;
mod comstruct; pub use self::comstruct::*;
mod cominterface; pub use self::cominterface::*;
mod comimpl; pub use self::comimpl::*;
mod comcrate; pub use self::comcrate::*;