use super::{conversion_from_glib, parameter_ffi_call_out}; use crate::analysis::{ function_parameters::TransformationType, return_value, safety_assertion_mode::SafetyAssertionMode, }; #[derive(Clone, Debug)] pub enum Chunk { Comment(Vec), Chunks(Vec), BlockHalf(Vec), // Block without open bracket, temporary UnsafeSmart(Vec), // TODO: remove (will change generated results) Unsafe(Vec), #[allow(clippy::upper_case_acronyms)] FfiCallTODO(String), FfiCall { name: String, params: Vec, ignore_return: bool, }, FfiCallParameter { transformation_type: TransformationType, }, FfiCallOutParameter { par: parameter_ffi_call_out::Parameter, }, // TODO: separate without return_value::Info FfiCallConversion { ret: return_value::Info, array_length_name: Option, call: Box, }, Let { name: String, is_mut: bool, value: Box, type_: Option>, }, Uninitialized, UninitializedNamed { name: String, }, NullPtr, NullMutPtr, Custom(String), Tuple(Vec, TupleMode), FromGlibConversion { mode: conversion_from_glib::Mode, array_length_name: Option, value: Box, }, OptionalReturn { condition: String, value: Box, }, AssertErrorSanity, ErrorResultReturn { ret: Option>, value: Box, }, AssertInit(SafetyAssertionMode), Connect { signal: String, trampoline: String, in_trait: bool, is_detailed: bool, }, Name(String), ExternCFunc { name: String, parameters: Vec, body: Box, return_value: Option, bounds: String, }, Cast { name: String, type_: String, }, Call { func_name: String, arguments: Vec, }, } impl Chunk { pub fn is_uninitialized(&self) -> bool { matches!(*self, Self::Uninitialized) } } #[derive(Clone, Debug)] pub struct Param { pub name: String, pub typ: String, } pub fn chunks(ch: Chunk) -> Vec { vec![ch] } #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum TupleMode { Auto, // "", "1", "(1,2)" WithUnit, // "()", "1", "(1,2)" #[deprecated] #[allow(dead_code)] Simple, // "()", "(1)", "(1,2)" }