Skip to main content

divisor_op

Macro divisor_op 

Source
macro_rules! divisor_op {
    (
        $fn:ident,
        $t:ty,
        $divisor:ident,
        |$d:ident| $fallible:expr,
        |$len:ident| $max_nulls:expr,
        [$($variant:ident),+]
    ) => { ... };
}
Expand description

Defines $fn, which computes / or % of an array by a scalar with a precomputed divisor. It returns None for an op other than / and %, when the scalar is null, or when a value could fail to divide by it (zero, or $fallible for /), so that integer_op returns an error only for a valid value that fails. Otherwise no value can fail, and unary divides every slot, null or not, unless the array has more than $max_nulls nulls, where dividing only the valid values with try_unary costs less