Skip to content

pantoken / platforms/rust/src / toRust

Feidhm: toRust()

toRust(tokens, options?): string

Turgnamhach

Eisigh comhsheasmhachtaí Rust le haghaidh IR token shonraithe.

Paraiméadair

tokens

neamh-inathraitheach Token[]

An IR.

options?

RustOptions = {}

RustOptions.

Tuairisceáin

string

An fhoinse Rust (modúl de pub consts).

Samplaí

egui (Color32), an fhormáid réamhshocraithe

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 dorcha

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