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”:
- C API recibe void* ptr del caller (datos en memoria C)
- Rust crea ArrayView con slice::from_raw_parts (sin to_vec!)
- ArrayView se guarda en Box y retorna opaque pointer al caller
- Caller usa ese handle para múltiples operaciones
- Caller destruye el handle cuando termina
Enums§
- Array
View - View into typed array data - wraps borrowed slices (no copies!)