Module foundations

Source
Expand description

Foundational types and functions.

Re-exports§

pub use self::repr::Repr;

Modules§

calc
Calculations and processing of numeric values.
ops
Operations on values.
repr
Debug representation of values.
sys
System-related things.

Macros§

array
Create a new Array from values.
cast
Implements Reflect, FromValue, and IntoValue for a type.
dict
Create a new Dict from key-value pairs.
format_str
Create a new Str from a format string.
select_where
A helper macro to create a field selector used in Selector::Elem

Structs§

Arg
An argument to a function call: 12 or draw: false.
Args
Captured arguments to a function.
Array
A sequence of values.
AutoValue
A value that indicates a smart default.
Binding
A bound value with metadata.
Bytes
A sequence of bytes.
Closure
A user-defined closure.
Content
A piece of document content.
Context
Data that is contextually made available to code.
ContextElem
Executes a context block.
Decimal
A fixed-point decimal number type.
Depth
A type that accumulates depth when folded.
Derived
A type that contains a user-visible source portion and something that is derived from it, but not user-visible.
Dict
A map from string keys to values.
DisplayPattern
A format in which a datetime can be displayed.
Duration
Represents a positive or negative span of time.
Dynamic
A value that is not part of the built-in enum.
Element
A document element.
Entries
An iterator over the entries in a style chain.
Func
A mapping from argument values to a return value.
Label
A label for an element.
Links
An iterator over the links of a style chain.
LocatableSelector
A selector that can be used with query.
Module
An module of definitions.
NativeElementData
Defines a native element.
NativeFuncData
Defines a native function.
NativeTypeData
Defines a native type.
NoneValue
A value that indicates the absence of any other value.
OneOrMultiple
One element, or multiple provided as an array.
Packed
A packed element of a static type.
ParamInfo
Describes a function parameter.
PluginFunc
A function loaded from a WebAssembly plugin.
Property
A style property originating from a set rule or constructor.
Recipe
A show rule recipe.
RecipeIndex
Identifies a show rule recipe from the top of the chain.
Regex
A regular expression.
Scope
A map from binding names to values.
Scopes
A stack of scopes.
SequenceElem
A sequence of content.
ShowableSelector
A selector that can be used with show rules.
Str
A sequence of Unicode codepoints.
StyleChain
A chain of styles, similar to a linked list.
StyledElem
Content alongside styles.
Styles
A list of style properties.
Symbol
A Unicode symbol.
SymbolElem
A single character.
SymbolVariant
A value that can be cast to a symbol.
TargetElem
This element exists solely to host the target style chain field. It is never constructed and not visible to users.
ToArray
A value that can be cast to bytes.
ToBytes
A value that can be cast to bytes.
ToDict
A value that can be cast to dictionary.
ToFloat
A value that can be cast to a float.
ToInt
A value that can be cast to an integer.
Type
Describes a kind of value.
Version
A version with an arbitrary number of components.

Enums§

ArgumentKey
A key that can be used to get an argument: either the index of a positional argument, or the name of a named argument.
Capturer
What the variable was captured by.
CastInfo
Describes a possible value for a cast.
Datetime
Represents a date, a time, or a combination of both.
Endianness
Represents the byte order used for converting integers and floats to bytes and vice versa.
FieldAccessError
An error arising when trying to access a field of content.
Never
An uninhabitable type.
Replacement
A replacement for a matched Str
Selector
A filter for selecting elements within the document.
Smart
A value that can be automatically determined.
StrPattern
A pattern which can be searched for in a string.
StrSide
A side of a string.
Style
A single style property or recipe.
Target
The export target.
ToDecimal
A value that can be cast to a decimal.
ToStr
A value that can be cast to a string.
Transformation
A show rule transformation that can be applied to a match.
Value
A computational value.
VersionComponents
One or multiple version components.

Traits§

AlternativeFold
A variant of fold for foldable optional (Option<T>) values where an inner None value isn’t respected (contrary to Option’s usual Fold implementation, with which folding with an inner None always returns None). Instead, when either of the Option objects is None, the other one is necessarily returned by fold_or. Normal folding still occurs when both values are Some, using T’s Fold implementation.
Capable
Used to cast an element to a trait object for a trait it implements.
Chainable
Things that can be attached to a style chain.
Construct
An element’s constructor function.
Container
A container for an argument.
Fields
Defines how fields of an element are accessed.
Fold
A property that is folded to determine its final value.
FromValue
Try to cast a Typst Value into a Rust type.
IntoArgs
Things that can be used as arguments.
IntoResult
Cast a Rust type or result into a SourceResult<Value>.
IntoValue
Cast a Rust type into a Typst Value.
NativeElement
A Typst element that is defined by a native Rust type.
NativeFunc
A Typst function that is defined by a native Rust type that shadows a native Rust function.
NativeScope
Defines the associated scope of a Rust type.
NativeType
A Typst type that is defined by a native Rust type.
PlainText
Tries to extract the plain-text representation of the element.
Reflect
Determine details of a type.
Resolve
A property that is resolved with other properties from the style chain.
Set
An element’s set rule.
Show
Defines a built-in show rule for an element.
ShowSet
Defines built-in show set rules for an element.
Synthesize
Synthesize fields on an element. This happens before execution of any show rule.
Unlabellable
Indicates that an element cannot be labelled.

Functions§

assert
Ensures that a condition is fulfilled.
convert_float_to_int
eval
Evaluates a string as Typst code.
fields_on
List the available fields for a type.
panic
Fails with an error.
plugin
Loads a WebAssembly module.
target
Returns the current export target.

Attribute Macros§

elem
Makes a native Rust type usable as a Typst element.
func
Makes a native Rust function usable as a Typst function.
scope
Provides an associated scope to a native function, type, or element.
ty
Makes a native Rust type usable as a Typst type.

Derive Macros§

Cast
Implements Reflect, FromValue, and IntoValue for an enum.