pub mod bootstrap;
pub mod proven;
pub mod codegen;
#[derive(Debug)]
pub struct Deprecation {
since: String,
note: String,
}
#[derive(Debug)]
pub struct Function {
pub name: String,
pub description: Option<String>,
pub features: Vec<String>,
pub args: Vec<Argument>,
pub derived_types: Vec<Argument>,
pub ret: Argument,
pub supports_partial: bool,
pub has_ffi: bool,
pub deprecation: Option<Deprecation>,
}
#[derive(Debug, Default, Clone)]
pub struct Argument {
pub name: Option<String>,
pub c_type: Option<String>,
pub rust_type: Option<TypeRecipe>,
pub hint: Option<String>,
pub description: Option<String>,
pub default: Option<Value>,
pub is_type: bool,
pub do_not_convert: bool,
pub example: Option<TypeRecipe>,
}
impl Argument {
fn generics(&self, variables: &Vec<String>) -> Vec<String> {
variables
.iter()
.filter(|v| Some(*v) != self.name.as_ref())
.cloned()
.collect()
}
}
#[derive(Debug, PartialEq, Clone)]
pub enum TypeRecipe {
Name(String),
Nest {
origin: String,
args: Vec<TypeRecipe>,
},
None,
Function {
function: String,
params: Vec<TypeRecipe>,
},
}
#[derive(Debug, Default, Clone)]
pub enum Value {
#[default]
Null,
Bool(bool),
String(String),
Integer(i64),
Float(f64),
}