Skip to main content

Module numeric_in

Module numeric_in 

Source
Expand description

Flexible numeric-input helpers — accept any of NumericArray, PackedArray, or ByteArray on the wire and widen the element type into the caller’s target T. The widening rules are lossless: a source type is accepted only when every value of its domain is exactly representable in the target.

Used by the hand-written Vec<T> impls in [crate::from_wolfram] and by the field-extract code emitted by the FromWolfram derive macro (VecOfNumeric and NumericTensor field kinds).

ByteArray on the wire is treated as a 1-D NumericArray<Integer8> before the widening rules apply.

Traits§

NumericTarget
Sealed trait implemented for each numeric primitive that the WXF derive / hand-impl path can read into. Each impl knows its target DT and how to widen from any compatible source DT.

Functions§

read_fixed
Like read_vec but errors if the resulting buffer length doesn’t equal n.
read_fixed_with_tag
read_fixed given an already-consumed expression token.
read_vec
Read the next value as a flat Vec<T>. Accepts NumericArray, PackedArray (any rank — multi-dim flattens row-major), or ByteArray (treated as a 1-D NumericArray<Integer8>).
read_vec_with_tag
read_vec given an already-consumed expression token.