Struct Builder

Source
pub struct Builder { /* private fields */ }
Expand description

A builder pattern for the Rust-to-C# conversion process.

Implementations§

Source§

impl Builder

Source

pub fn new<T: AsRef<str>>(dll_name: T, rust_code: String) -> Self

Creates a new instance with the following arguments:

  • dll_name is the name of the DLL that the C# DllImport attribute will be bound to for all exported functions.

  • rust_code is the source Rust code to convert into C#.

Source

pub fn class_name<T: AsRef<str>>(self, class_name: T) -> Self

Sets the name of the C# class that will contain all exported functions. If never called, the C# class will be called RustExports.

Source

pub fn ignore(self, ignores: &[&str]) -> Self

Specifies a list of Rust identifier patterns to be ignored (i.e., not exported to C#).

The pattern syntax is currently very simple: if it ends with a *, it matches any Rust identifier that starts with the part of the pattern before the * (e.g., Boop* matches BoopJones and BoopFoo). Otherwise, it represents an exact match to a Rust identifier.

Source

pub fn access<T: AsRef<str>>(self, symbol_name: T, access: CSAccess) -> Self

Specifies that the given Rust identifier should be exported to C# with the given C# access modifier. By default, all exports are given the internal access modifier.

Source

pub fn generate(self) -> Result<String, Error>

Performs the conversion of source Rust code to C#.

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.