Trait NativeType

Source
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§

Source

const NAME: &'static str

The type’s name.

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

Required Methods§

Source

fn data() -> &'static NativeTypeData

Provided Methods§

Source

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§

Source§

impl NativeType for bool

Source§

const NAME: &'static str = "bool"

Source§

fn data() -> &'static NativeTypeData

Source§

impl NativeType for f64

Source§

const NAME: &'static str = "float"

Source§

fn data() -> &'static NativeTypeData

Source§

impl NativeType for i64

Source§

const NAME: &'static str = "int"

Source§

fn data() -> &'static NativeTypeData

Implementors§

Source§

impl NativeType for Datetime

Source§

const NAME: &'static str = "datetime"

Source§

impl NativeType for Selector

Source§

const NAME: &'static str = "selector"

Source§

impl NativeType for Alignment

Source§

const NAME: &'static str = "alignment"

Source§

impl NativeType for Dir

Source§

const NAME: &'static str = "direction"

Source§

impl NativeType for Color

Source§

const NAME: &'static str = "color"

Source§

impl NativeType for Gradient

Source§

const NAME: &'static str = "gradient"

Source§

impl NativeType for Bytes

Source§

const NAME: &'static str = "bytes"

Source§

impl NativeType for Dict

Source§

const NAME: &'static str = "dictionary"

Source§

impl NativeType for Counter

Source§

const NAME: &'static str = "counter"

Source§

impl NativeType for Location

Source§

const NAME: &'static str = "location"

Source§

impl NativeType for State

Source§

const NAME: &'static str = "state"

Source§

impl NativeType for Angle

Source§

const NAME: &'static str = "angle"

Source§

impl NativeType for Fr

Source§

const NAME: &'static str = "fraction"

Source§

impl NativeType for Length

Source§

const NAME: &'static str = "length"

Source§

impl NativeType for Ratio

Source§

const NAME: &'static str = "ratio"

Source§

impl NativeType for Rel

Source§

const NAME: &'static str = "relative"

Source§

impl NativeType for Stroke

Source§

const NAME: &'static str = "stroke"

Source§

impl NativeType for Tiling

Source§

const NAME: &'static str = "tiling"

Source§

impl NativeType for Args

Source§

const NAME: &'static str = "arguments"

Source§

impl NativeType for Array

Source§

const NAME: &'static str = "array"

Source§

impl NativeType for AutoValue

Source§

const NAME: &'static str = "auto"

Source§

impl NativeType for Content

Source§

const NAME: &'static str = "content"

Source§

impl NativeType for Decimal

Source§

const NAME: &'static str = "decimal"

Source§

impl NativeType for Duration

Source§

const NAME: &'static str = "duration"

Source§

impl NativeType for Func

Source§

const NAME: &'static str = "function"

Source§

impl NativeType for Label

Source§

const NAME: &'static str = "label"

Source§

impl NativeType for Module

Source§

const NAME: &'static str = "module"

Source§

impl NativeType for NoneValue

Source§

const NAME: &'static str = "none"

Source§

impl NativeType for Regex

Source§

const NAME: &'static str = "regex"

Source§

impl NativeType for Str

Source§

const NAME: &'static str = "str"

Source§

impl NativeType for Styles

Source§

const NAME: &'static str = "styles"

Source§

impl NativeType for Symbol

Source§

const NAME: &'static str = "symbol"

Source§

impl NativeType for Type

Source§

const NAME: &'static str = "type"

Source§

impl NativeType for Version

Source§

const NAME: &'static str = "version"