Azure / Azure/typespec-rust

Refact constants into separate type

Open
#889 1 comment 0 reactions 0 assignees View on GitHub
CodeGen
Dominant language
Rust
Stars
7
Forks
11
Avg merge
2d 5h
Merged PRs (30d)
5

Description

I think this could be folded into `defaultValue` as a new `Constant` type (might be useful elsewhere).
```ts
/** Constant defines a Rust const declaration */
export interface Constant {
kind: 'constant';

/** the name of the const */
name: string;

/** the value of the const */
value: Literal;

/** indicates the visibility of the const */
visibility: Visibility;
}
```
Then we can update the definition accordingly.
```ts
defaultValue?: Constant | string;
```

_Originally posted by @jhendrixMSFT in https://github.com/Azure/typespec-rust/pull/887#discussion_r2884751124_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.