spirv_tools_sys/
diagnostics.rs

1#[repr(C)]
2pub struct Position {
3    pub line: usize,
4    pub column: usize,
5    pub index: usize,
6}
7
8#[repr(C)]
9pub struct Diagnostic {
10    pub position: Position,
11    pub error: *const std::os::raw::c_char,
12    pub is_text_source: bool,
13}
14
15#[derive(Copy, Clone, PartialEq, Debug)]
16#[repr(C)]
17pub enum MessageLevel {
18    /// Unrecoverable error due to environment.
19    /// Will exit the program immediately. E.g.,
20    /// out of memory.
21    Fatal,
22    /// Unrecoverable error due to SPIRV-Tools
23    /// internals.
24    /// Will exit the program immediately. E.g.,
25    /// unimplemented feature.
26    InternalError,
27    /// Normal error due to user input.
28    Error,
29    /// Warning information.
30    Warning,
31    /// General information.
32    Info,
33    /// Debug information.
34    Debug,
35}
36
37pub type MessageCallback = extern "C" fn(
38    MessageLevel,                // level
39    *const std::os::raw::c_char, // source
40    *const Position,             // source position
41    *const std::os::raw::c_char, // the actual message
42    *mut std::ffi::c_void,       // context we use for mapping
43);
44
45extern "C" {
46    /// Destroys a diagnostic object.  This is a no-op if diagnostic is a null
47    /// pointer.
48    #[link_name = "spvDiagnosticDestroy"]
49    pub fn diagnostic_destroy(diag: *mut Diagnostic);
50}