pub struct CSharpConfiguration { /* private fields */ }
Expand description
This struct holds the generic data used between multiple builds. Currently this only holds the type registry, but further features such as ignore patterns will likely be added here.
Implementations§
Source§impl CSharpConfiguration
impl CSharpConfiguration
Sourcepub fn new(csharp_version: u8) -> Self
pub fn new(csharp_version: u8) -> Self
Create a new C# configuration. Input parameter is the target version of C#, i.e. C# 7, 8, 9, etc.
Sourcepub fn add_known_type(
&mut self,
rust_type_name: &str,
csharp_namespace: Option<String>,
csharp_inside_type: Option<String>,
csharp_type_name: String,
)
pub fn add_known_type( &mut self, rust_type_name: &str, csharp_namespace: Option<String>, csharp_inside_type: Option<String>, csharp_type_name: String, )
Register a type the converter should know about.
Useful if you use a type on the Rust side that you know has a C# representation without first passing it through the C#builder. This function takes the Rust type name, along with an optional C# namespace, optional containing type, and the actual C# type name.
Sourcepub fn set_out_type(&mut self, rust_type_name: &str)
pub fn set_out_type(&mut self, rust_type_name: &str)
Sets a rust type to represent an out parameter in C#.
This allows converting a parameter like foo: Out<u8>
into out byte foo
.
Useful for following patterns such as: https://github.com/KodrAus/rust-csharp-ffi
Sourcepub fn set_generated_warning(&mut self, generated_warning: &str)
pub fn set_generated_warning(&mut self, generated_warning: &str)
By default we add a warning on top of each generated C# script, which defaults to
// Automatically generated, do not edit!
. This functions allows you to modify this
warning. Can be multiline, and can be removed entirely by setting with an empty string.