Serialization and output
Serialization is a lossless interchange format for supported mathematical objects. Rendering is a presentation operation and does not change the object.
Output and serialization#
to_latex#
Explicit context
func toLatex(target: UniffiExpression) -> StringCalling forms and variants
Expression method: UniffiExpression.toLatex
func toLatex() -> StringVariant for this object — UniffiCircle2d method: UniffiCircle2d.toLatex
func toLatex() -> StringVariant for this object — UniffiMatrix method: UniffiMatrix.toLatex
func toLatex() -> StringVariant for this object — UniffiPoint2d method: UniffiPoint2d.toLatex
func toLatex() -> StringVariant for this object — UniffiPolygon2d method: UniffiPolygon2d.toLatex
func toLatex() -> StringVariant for this object — UniffiSegment2d method: UniffiSegment2d.toLatex
func toLatex() -> StringVariant for this object — UniffiTriangle2d method: UniffiTriangle2d.toLatex
func toLatex() -> StringRender an expression as LaTeX. Matrices and geometry objects have their own
to_latex methods.
to_latex_with_options#
Explicit context
func toLatexWithOptions(
inputExpression: UniffiExpression,
options: UniffiLatexPresentationOptions,
) -> StringCalling forms
Expression method: UniffiExpression.toLatexWithOptions
func toLatexWithOptions(options: UniffiLatexPresentationOptions) -> StringRender an expression as LaTeX with presentation flags. Each argument is a string
naming the choice for one flag; an unrecognized name falls back to that flag's
canonical default (so to_latex_with_options(e, "", "", "") equals
to_latex(e)):
exponential_style:"exp_function"(default,\exp(u)) or"e_caret"(e^{u}, the form the LaTeX parser reads back as exponentiation).natural_logarithm_style:"log"(default,\log) or"ln"(\ln).multiletter_symbol_style:"italic"(default,\mathit{name}) or"upright"(\mathrm{name}).
The defaults are fixed, content-independent canonical choices. Readability
heuristics (for example, switching a tall exponent to \exp) belong in the
caller, via the render-twice pattern: render with the default, test the result,
and re-render with the other flag value if it violates the heuristic.
serialize_object#
Explicit context
func serializeObject(object: UniffiMathematicalObject) -> StringCalling forms and variants
Expression method: UniffiExpression.serializeObject
func serializeObject() -> StringVariant for this object — UniffiCircle2d method: UniffiCircle2d.serializeObject
func serializeObject() -> StringVariant for this object — UniffiMatrix method: UniffiMatrix.serializeObject
func serializeObject() -> StringVariant for this object — UniffiPoint2d method: UniffiPoint2d.serializeObject
func serializeObject() -> StringVariant for this object — UniffiPolygon2d method: UniffiPolygon2d.serializeObject
func serializeObject() -> StringVariant for this object — UniffiSegment2d method: UniffiSegment2d.serializeObject
func serializeObject() -> StringVariant for this object — UniffiTriangle2d method: UniffiTriangle2d.serializeObject
func serializeObject() -> StringSerialize an expression, matrix, or geometry object to the stable Symi
serialization format, round-trippable via parse_serialized_object.
Notes: in WASM this is a per-object method because a single polymorphic context method cannot downcast a JsValue back to an exported Rust type.
parse_serialized_object#
Explicit context
func parseSerializedObject(text: String) -> UniffiMathematicalObjectInverse of serialize_object; returns the matching surface class.