Skip to main content

Crate typst_utils

Crate typst_utils 

Source
Expand description

Utilities for Typst.

Modules§

fat
Fat pointer handling.

Macros§

assign_impl
Implement an assign trait based on an existing non-assign trait.
display
Accecpts the same arguments as the format! macro and forwards them to crate::display().
display_possible_values
Implements Display for a type that implements clap’s ValueEnum via to_possible_values.
singleton
Create a lazy initialized, globally unique 'static reference to a value.
sub_impl
Implement the Sub trait based on existing Neg and Add impls.

Structs§

BitSet
Stores a set of numbers which are expected to be rather small.
DefSite
Describes the source code where something is defined.
Deferred
A value that is lazily executed on another thread.
GroupByKey
This struct is created by SliceExt::group_by_key.
HashLock
Storage for lazy hash computation.
LazyHash
A wrapper type with lazily-computed hash.
ListSet
A set backed by a mutable slice-like data structure.
ManuallyHash
A wrapper type with a manually computed hash.
PicoStr
An interned string representation that is cheap to copy and hash, but more expensive to access.
Protected
Wraps a type, requiring justification on access.
ResolvedPicoStr
This is returned by PicoStr::resolve.
Scalar
A 64-bit float that implements Eq, Ord and Hash.
SmallBitSet
Efficiently stores a set of numbers which are expected to be very small. Values < 32/64 (depending on the architecture) are stored inline, while values larger than that will lead to an allocation.
Static
A container around a static reference that is cheap to clone and hash.
TypstVersion
Typst version definition.

Traits§

Get
Generic access to a structure’s components.
MaybeReverseIter
Adapter for reversing iterators conditionally.
NonZeroExt
An extra constant for NonZeroUsize.
Numeric
A numeric type.
NumericLength
A marker trait for numeric lengths.
OptionExt
Extra methods for Option.
Rdedup
A variant of dedup that keeps the later value rather than the earlier one.
SliceExt
Extra methods for [T].

Functions§

debug
Turn a closure into a struct implementing Debug.
default_math_class
Returns the default math class of a character in Typst, if it has one.
defer
Automatically calls a deferred function when the returned handle is dropped.
display
Turn a closure into a struct implementing Display.
display_commit
Displays the commit Typst was built from human-readably.
format_duration
Formats a duration with a precision suitable for human display.
hash128
Calculate a 128-bit siphash of a value.
option_eq
Check if the Option-wrapped L is same to R.
round_int_with_precision
This is used for rounding into integer digits, and is a no-op for positive precision.
round_with_precision
Returns value with n digits after floating point where n is precision. Standard rounding rules apply (if n+1th digit >= 5, round away from zero).
version
Returns the version of Typst.