1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Author: Abdulwahed Mansour
//! ASGI-compatible async context handling for Django.
//!
//! Provides utilities for running Rust-accelerated operations within Django's
//! async view layer (ASGI) without blocking the event loop. This module bridges
//! PyForge's coroutine support with Django's async view dispatch.
use *;
use crateDjangoError;
use crate;
use crate;
use crate;
/// Serializes model fields while releasing the Python GIL during computation.
///
/// Intended for use from Django async views where holding the GIL would block
/// other coroutines. The caller must provide pre-extracted `FieldValue` data
/// (Python-to-Rust conversion happens before this call, while holding the GIL).
///
/// # Arguments
/// * `py` - The Python GIL token, released during the Rust computation phase.
/// * `descriptors` - Field metadata extracted from the Django model.
/// * `values` - Field values already converted from Python objects.
///
/// # Returns
/// A `SerializedRecord` (JSON-compatible map), or `DjangoError` on failure.
/// Validates a field batch while releasing the Python GIL.
///
/// For large batches, this enables Rayon's parallel validation to run across
/// multiple CPU cores without being bottlenecked by the GIL.
///
/// # Arguments
/// * `py` - The Python GIL token, released during validation.
/// * `entries` - Pairs of field descriptors and values to validate.
///
/// # Returns
/// A `ValidationReport` with per-field error details.