Skip to content

pantoken-root / platforms/rust/src / toRust

Fušla: toRust() ​

toRust(tokens, options?): string

Eksperimentála

Gávdnat Rust-konstanttat bargu dávvuden token IR:šii.

Parametera ​

tokens ​

ruvvojuvvon Token[]

IR.

options? ​

RustOptions = {}

RustOptions.

Gullii / Gávdnat ​

string

Rust-báikki (moduulma pub const-doga).

Exempla ​

egui (Color32), boađeformáhta

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

const source = toRust(byTheme("rebrand"));
// "use egui::Color32;\npub fn color_background_brand() -> Color32 { Color32::from_rgb(…) }"

iced (Color), ruoksá modu

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: … };"