Skip to content

pantoken / platforms/rust/src / toRust

Fonksyon: toRust()

toRust(tokens, options?): string

Eksperimantal

Emèt konstan Rust pou yon IR token eksplisit.

Paramèt

tokens

sèlman lekti Token[]

IR la.

options?

RustOptions = {}

RustOptions.

Retounen

string

Sous Rust la (yon modil nan pub consts).

Egzanp

egui (Color32), fòma default

ts
import { toRust } from "@pantoken/rust";
import { byTheme } from "@pantoken/tokens";

const source = toRust(byTheme("rebrand"));
// "use egui::Color32;\npub const COLOR_BACKGROUND_BRAND: Color32 = Color32::from_rgb(…);"

iced (Color), mòd nwa

ts
import { toRust } from "@pantoken/rust";
import { byTheme } from "@pantoken/tokens";

const source = toRust(byTheme("rebrand"), { format: "iced", mode: "dark" });
// "use iced::Color;\npub const COLOR_BACKGROUND_BRAND: Color = Color { r: …, g: …, b: …, a: … };"