How to use annotation get key name?
Simen Kjærås
simen.kjaras at gmail.com
Mon Mar 26 08:50:31 UTC 2018
On Monday, 26 March 2018 at 08:29:31 UTC, Brian wrote:
> Rust sample code:
>
> #[cfg(name = "users")]
>
> PHP sample code:
>
> /*
> @Table(name = "users")
> */
>
> Java sample code:
>
> @Table(name = "users")
>
> How to use dlang get key name?
If I understand your question correctly:
struct Table {
string name;
}
struct Foo {
@Table("foo")
int n;
}
unittest {
import std.traits;
string name = getUDAs!(Foo.n, Table)[0].name;
}
--
Simen
More information about the Digitalmars-d-learn
mailing list