Struct CSharpConfiguration

Source
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

Source

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.

Source

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.

Source

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

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.