Ferrous API Reference

All Types / Ferrous

class MustUseAttribute

public sealed class MustUseAttribute : Attribute

Indicates that a return value or an instance of the annotated type should not be silently ignored. Equivalent to Rust's #[must_use] attribute.

Constructors

public MustUseAttribute()

Initializes a new instance of the MustUseAttribute class.

public MustUseAttribute(string reason)

Initializes a new instance of the MustUseAttribute class with an explanatory reason.

Parameters
reason
A message explaining why the value must be used.

Properties

public string? Reason

Gets the optional reason explaining why the value must be used.