use crate::ffi::{StableOption, StableSlice};
use std::num::NonZeroU8;
use std::os::raw::c_char;
use std::ptr::NonNull;
pub mod ffi;
#[repr(C)]
#[derive(Debug)]
pub struct StableToken {
pub span: StableTextSpan,
pub ptr: *const u8,
pub len: usize,
}
#[repr(C)]
#[derive(Debug)]
pub struct StableTextSpan {
pub start: u32,
pub end: u32,
}
#[repr(C)]
#[derive(Debug)]
pub enum StableTokenTree {
Ident(StableToken),
}
#[repr(C)]
#[derive(Debug)]
pub struct StableExpansion {
pub name: *mut c_char,
pub kind: StableExpansionKind,
}
pub type StableExpansionKind = NonZeroU8;
pub type StableExpansionsList = StableSlice<StableExpansion>;
#[repr(C)]
#[derive(Debug)]
pub struct StableTokenStream {
pub tokens: StableSlice<StableTokenTree>,
pub metadata: StableTokenStreamMetadata,
pub size_hint: usize,
}
#[repr(C)]
#[derive(Debug)]
pub struct StableTokenStreamMetadata {
pub original_file_path: Option<NonNull<c_char>>,
pub file_id: Option<NonNull<c_char>>,
pub edition: Option<NonNull<c_char>>,
}
pub type StableAuxData = StableOption<StableSlice<u8>>;
#[repr(C)]
#[derive(Debug)]
pub struct StableDiagnostic {
pub message: *mut c_char,
pub severity: StableSeverity,
pub spans: StableSlice<StableTextSpan>,
}
pub type StableSeverity = NonZeroU8;
#[repr(C)]
#[derive(Debug)]
pub struct StableProcMacroResult {
pub token_stream: StableTokenStream,
pub diagnostics: StableSlice<StableDiagnostic>,
pub aux_data: StableAuxData,
pub full_path_markers: StableSlice<*mut c_char>,
}
#[repr(C)]
pub struct StableResultWrapper {
pub input: StableTokenStream,
pub input_attr: StableTokenStream,
pub output: StableProcMacroResult,
}
#[repr(C)]
pub struct StablePostProcessContext {
pub aux_data: StableSlice<StableAuxData>,
pub full_path_markers: StableSlice<StableFullPathMarker>,
}
#[repr(C)]
pub struct StableFullPathMarker {
pub key: *mut c_char,
pub full_path: *mut c_char,
}