# RustAppHostingExtension Methods

- Package: [CommunityToolkit.Aspire.Hosting.Rust](/reference/api/csharp/communitytoolkit.aspire.hosting.rust.md)
- Type: [RustAppHostingExtension](/reference/api/csharp/communitytoolkit.aspire.hosting.rust/rustapphostingextension.md)
- Kind: `Methods`
- Members: `2`

Provides extension methods for adding Rust applications to an `Hosting.IDistributedApplicationBuilder`.

## AddBaconApp(IDistributedApplicationBuilder, string, string, string[]?)

- Name: `AddBaconApp(IDistributedApplicationBuilder, string, string, string[]?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<RustAppExecutableResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Rust/RustAppHostingExtension.cs#L56-L64)

Adds a Rust application to the application model, using the bacon cli.

```csharp
public static class RustAppHostingExtension
{
    public static IResourceBuilder<RustAppExecutableResource> AddBaconApp(
        this IDistributedApplicationBuilder builder,
        string name,
        string workingDirectory,
        string[]? args = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The `Hosting.IDistributedApplicationBuilder` to add the resource to.
- `name` (`string`)
  The name of the resource.
- `workingDirectory` (`string`)
  The working directory to use for the command.
- `args` (`string[]?`) `optional`
  The optional arguments to be passed to the bacon command.

## Returns

`IResourceBuilder<RustAppExecutableResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1`.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## AddRustApp(IDistributedApplicationBuilder, string, string, string[]?)

- Name: `AddRustApp(IDistributedApplicationBuilder, string, string, string[]?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<RustAppExecutableResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Rust/RustAppHostingExtension.cs#L29-L37)

Adds a Rust application to the application model, using the cargo cli.

```csharp
public static class RustAppHostingExtension
{
    public static IResourceBuilder<RustAppExecutableResource> AddRustApp(
        this IDistributedApplicationBuilder builder,
        string name,
        string workingDirectory,
        string[]? args = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The `Hosting.IDistributedApplicationBuilder` to add the resource to.
- `name` (`string`)
  The name of the resource.
- `workingDirectory` (`string`)
  The working directory to use for the command.
- `args` (`string[]?`) `optional`
  The optional arguments to be passed to the executable when it is started.

## Returns

`IResourceBuilder<RustAppExecutableResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1`.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.
