pub struct SimpleMapCtx<'a, 'b> { /* private fields */ }Expand description
Elementwise mapping context (minimal unary-numeric support for Milestone 3)
This initial version targets unary numeric builtins (e.g., SIN/COS).
It detects an array/range input, iterates elementwise in row-major order,
applies the provided unary function, and produces an output LiteralValue:
- Scalar input => caller should prefer scalar fallback; this context is designed for array/range cases and returns an error if no array present.
Implementations§
Source§impl<'a, 'b> SimpleMapCtx<'a, 'b>
impl<'a, 'b> SimpleMapCtx<'a, 'b>
pub fn new( args: &'a [ArgumentHandle<'a, 'b>], ctx: &'a dyn FunctionContext, ) -> Self
pub fn input_count(&self) -> usize
pub fn broadcast_shape(&self) -> (usize, usize)
pub fn is_array_context(&self) -> bool
Sourcepub fn map_unary_numeric<F>(&mut self, f: F) -> Result<(), ExcelError>
pub fn map_unary_numeric<F>(&mut self, f: F) -> Result<(), ExcelError>
Map a unary numeric function over the (broadcasted) input. Policy: NumberLenientText; non-coercible values yield #VALUE! per cell.
Sourcepub fn map_binary_numeric<F>(&mut self, f: F) -> Result<(), ExcelError>
pub fn map_binary_numeric<F>(&mut self, f: F) -> Result<(), ExcelError>
Binary numeric map with broadcasting across two inputs (args[0], args[1]).
pub fn take_output(self) -> LiteralValue
Trait Implementations§
Source§impl<'a, 'b> FnMapCtx for SimpleMapCtx<'a, 'b>
impl<'a, 'b> FnMapCtx for SimpleMapCtx<'a, 'b>
Source§fn is_array_context(&self) -> bool
fn is_array_context(&self) -> bool
Whether inputs indicate an array/range context. If false, callers should fall back to scalar.
Source§fn map_unary_numeric(
&mut self,
f: &mut dyn FnMut(f64) -> Result<LiteralValue, ExcelError>,
) -> Result<(), ExcelError>
fn map_unary_numeric( &mut self, f: &mut dyn FnMut(f64) -> Result<LiteralValue, ExcelError>, ) -> Result<(), ExcelError>
Apply a unary numeric mapping over the broadcasted input. The closure should return the mapped cell.
Source§fn map_binary_numeric(
&mut self,
f: &mut dyn FnMut(f64, f64) -> Result<LiteralValue, ExcelError>,
) -> Result<(), ExcelError>
fn map_binary_numeric( &mut self, f: &mut dyn FnMut(f64, f64) -> Result<LiteralValue, ExcelError>, ) -> Result<(), ExcelError>
Apply a binary numeric mapping over the broadcasted inputs (first two args).
Source§fn finalize(&mut self) -> LiteralValue
fn finalize(&mut self) -> LiteralValue
Finalize and retrieve the output value (typically an Array). Implementations may move out internal buffers.
Auto Trait Implementations§
impl<'a, 'b> Freeze for SimpleMapCtx<'a, 'b>
impl<'a, 'b> !RefUnwindSafe for SimpleMapCtx<'a, 'b>
impl<'a, 'b> !Send for SimpleMapCtx<'a, 'b>
impl<'a, 'b> !Sync for SimpleMapCtx<'a, 'b>
impl<'a, 'b> Unpin for SimpleMapCtx<'a, 'b>
impl<'a, 'b> !UnwindSafe for SimpleMapCtx<'a, 'b>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more