pub struct FunctionHelperVirtual {
pub function_name: String,
pub generated_args: String,
pub generated_function_body: Vec<String>,
pub generated_virtual_function_signature: String,
pub return_type: Option<WrapperType>,
pub arg_names: Vec<String>,
/* private fields */
}
Fields§
§function_name: String
§generated_args: String
§generated_function_body: Vec<String>
§generated_virtual_function_signature: String
§return_type: Option<WrapperType>
§arg_names: Vec<String>
Implementations§
Source§impl FunctionHelperVirtual
impl FunctionHelperVirtual
Sourcepub fn from_virtual_function(function: &Function, class_name: &str) -> Self
pub fn from_virtual_function(function: &Function, class_name: &str) -> Self
Translates the intermediate form of a parsed function into the elements ready-to-use in the C++ code generation process. It prepares code for a C++ virtual method declaration and extern “C” function that calls the virtual method. Due to this, Rust code can call virtual C++ methods like trait functions.
Pseudocode:
Rust: SomeTrait { method_a(); }
Swift: Class SomeTrait { method_a(); }
@_cdecl __method_a(AnyType obj) { (obj as SomeTrait).method_a(); }
Sourcepub fn generate_virtual_declaration(self) -> String
pub fn generate_virtual_declaration(self) -> String
Generates a virtual function declaration that can be used within a class declaration.
Sourcepub fn generate_virtual_definition(self) -> String
pub fn generate_virtual_definition(self) -> String
Generates an extern function that calls the virtual method on a swift trait object that can be mapped to some Rust trait object.
Auto Trait Implementations§
impl Freeze for FunctionHelperVirtual
impl RefUnwindSafe for FunctionHelperVirtual
impl !Send for FunctionHelperVirtual
impl !Sync for FunctionHelperVirtual
impl Unpin for FunctionHelperVirtual
impl UnwindSafe for FunctionHelperVirtual
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more