tinymist_std::typst::foundations

Trait NativeType

pub trait NativeType {
    const NAME: &'static str;

    // Required method
    fn data() -> &'static NativeTypeData;

    // Provided method
    fn ty() -> Type { ... }
}
Expand description

A Typst type that is defined by a native Rust type.

Required Associated Constants§

const NAME: &'static str

The type’s name.

In contrast to data(), this is usable in const contexts.

Required Methods§

fn data() -> &'static NativeTypeData

Provided Methods§

fn ty() -> Type

Get the type for the native Rust type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl NativeType for bool

§

const NAME: &'static str = "bool"

§

fn data() -> &'static NativeTypeData

§

impl NativeType for f64

§

const NAME: &'static str = "float"

§

fn data() -> &'static NativeTypeData

§

impl NativeType for i64

§

const NAME: &'static str = "int"

§

fn data() -> &'static NativeTypeData

Implementors§

§

impl NativeType for Datetime

§

const NAME: &'static str = "datetime"

§

impl NativeType for Selector

§

const NAME: &'static str = "selector"

§

impl NativeType for Bytes

§

const NAME: &'static str = "bytes"

§

impl NativeType for Dict

§

const NAME: &'static str = "dictionary"

§

impl NativeType for Args

§

const NAME: &'static str = "arguments"

§

impl NativeType for Array

§

const NAME: &'static str = "array"

§

impl NativeType for AutoValue

§

const NAME: &'static str = "auto"

§

impl NativeType for Content

§

const NAME: &'static str = "content"

§

impl NativeType for Decimal

§

const NAME: &'static str = "decimal"

§

impl NativeType for Duration

§

const NAME: &'static str = "duration"

§

impl NativeType for Func

§

const NAME: &'static str = "function"

§

impl NativeType for Label

§

const NAME: &'static str = "label"

§

impl NativeType for Module

§

const NAME: &'static str = "module"

§

impl NativeType for NoneValue

§

const NAME: &'static str = "none"

§

impl NativeType for Regex

§

const NAME: &'static str = "regex"

§

impl NativeType for Str

§

const NAME: &'static str = "str"

§

impl NativeType for Styles

§

const NAME: &'static str = "styles"

§

impl NativeType for Symbol

§

const NAME: &'static str = "symbol"

§

impl NativeType for Type

§

const NAME: &'static str = "type"

§

impl NativeType for Version

§

const NAME: &'static str = "version"

§

impl NativeType for Alignment

§

const NAME: &'static str = "alignment"

§

impl NativeType for Angle

§

const NAME: &'static str = "angle"

§

impl NativeType for Color

§

const NAME: &'static str = "color"

§

impl NativeType for Counter

§

const NAME: &'static str = "counter"

§

impl NativeType for Dir

§

const NAME: &'static str = "direction"

§

impl NativeType for Fr

§

const NAME: &'static str = "fraction"

§

impl NativeType for Gradient

§

const NAME: &'static str = "gradient"

§

impl NativeType for Length

§

const NAME: &'static str = "length"

§

impl NativeType for Location

§

const NAME: &'static str = "location"

§

impl NativeType for Ratio

§

const NAME: &'static str = "ratio"

§

impl NativeType for Rel

§

const NAME: &'static str = "relative"

§

impl NativeType for State

§

const NAME: &'static str = "state"

§

impl NativeType for Stroke

§

const NAME: &'static str = "stroke"

§

impl NativeType for Tiling

§

const NAME: &'static str = "tiling"