Module array_view

Module array_view 

Source
Expand description

ArrayView - Zero-copy view into typed data for FFI operations

Este struct resuelve el problema de performance en FFI:

  • El caller mantiene ownership de los datos en C/Python/JS
  • ArrayView contiene solo referencias (slices) - NO copia datos
  • Compatible con dispatch system existente

§Arquitectura

Para FFI, usamos un patrón de “view handle”:

  1. C API recibe void* ptr del caller (datos en memoria C)
  2. Rust crea ArrayView con slice::from_raw_parts (sin to_vec!)
  3. ArrayView se guarda en Box y retorna opaque pointer al caller
  4. Caller usa ese handle para múltiples operaciones
  5. Caller destruye el handle cuando termina

Enums§

ArrayView
View into typed array data - wraps borrowed slices (no copies!)