# RustCargoArgsCallbackContext Constructors

- Package: [Aspire.Hosting.Rust](/reference/api/csharp/aspire.hosting.rust.md)
- Type: [RustCargoArgsCallbackContext](/reference/api/csharp/aspire.hosting.rust/rustcargoargscallbackcontext.md)
- Kind: `Constructors`
- Members: `1`

Represents callback context for cargo-level command-line arguments.

<a id="constructor"></a>
<a id="constructor-rustappresource-ilist-string-cancellationtoken"></a>

## RustCargoArgsCallbackContext(RustAppResource, IList<string>, CancellationToken)

- Name: `Constructor(RustAppResource, IList<string>, CancellationToken)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.Rust/RustCargoArgsCallbackAnnotation.cs#L46-L66)

Represents callback context for cargo-level command-line arguments.

```csharp
public sealed class RustCargoArgsCallbackContext
{
    public RustCargoArgsCallbackContext(
        RustAppResource resource,
        IList<string> args,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `resource` ([RustAppResource](/reference/api/csharp/aspire.hosting.rust/rustappresource.md))
  The Rust application resource whose cargo arguments are being built.
- `args` (`IList<string>`)
  The command-line arguments collection.
- `cancellationToken` (`CancellationToken`) `optional`
  The cancellation token associated with this callback context.

## Remarks

Unlike program arguments, cargo arguments are plain strings rather than `Object`. They select build behaviour ( `--release`, `--features`, `--bin`) before the program starts, so there is nothing for a deferred value such as an endpoint reference to resolve against; those belong after the `--` separator and are added with `WithArgs`.
