lisette-semantics 0.4.1

Little language inspired by Rust that compiles to Go
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Method-set keys for Go unexported (sealing) methods, keyed by bindgen's
//! `#[go(unexported, "<identity>")]` so structural satisfaction enforces the seal.

use ecow::EcoString;

/// `#` and `:` cannot appear in a Lisette identifier, so this key is unforgeable.
const UNEXPORTED_PREFIX: &str = "#unexported:";

pub fn unexported_key(id: &str) -> EcoString {
    format!("{UNEXPORTED_PREFIX}{id}").into()
}

pub fn is_unexported_key(key: &str) -> bool {
    key.starts_with(UNEXPORTED_PREFIX)
}