Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Snapshot · Oct 24, 2026 · Frozen documentation

AttributeTarget

Identifies one semantic declaration target accepted by typed metadata.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Module std.meta

import std.meta;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

AttributeTarget

pub enum AttributeTarget

Identifies one semantic declaration target accepted by typed metadata.

Targets describe declarations and their structural subdeclarations rather than syntax positions. .Any is exclusive when used by AttributeUsage.

Example

module example.attribute_policy;
from std.meta import AttributeRetention, AttributeTarget, AttributeUsage;

[AttributeUsage(.Field, Repeatable = true, Retention = .Runtime)]
[AttributeUsage(.Global, Repeatable = true, Retention = .Runtime)]
pub attribute Label {
    pub Text: str;
    init(Text: str) { this.Text = Text; }
}

[AttributeUsage(.Type, Retention = .CompileTimeOnly)]
pub attribute BuildHint { init() { } }

[BuildHint]
pub struct Record {
    [Label("identifier"), Label("database key")]
    pub Id: u64;
}

[Label("current record count")]
pub var RecordCount: i32 = 0;

fn Main() -> i32 { RecordCount += 1; return RecordCount; }
Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library