pub struct CsvLimits { /* private fields */ }Expand description
Bounds applied by read_str to defend against
adversarial input.
Every limit is checked while reading; exceeding one stops the read with a
CsvErrorKind::LimitExceeded. Build a
profile with conservative (the default) or
permissive, then tune individual limits with the
with_* methods.
Implementations§
Source§impl CsvLimits
impl CsvLimits
Sourcepub const fn conservative() -> Self
pub const fn conservative() -> Self
Conservative limits suitable for untrusted input: 1 MiB total, 65 536 records, 1 024 fields per record, 65 536 bytes per field.
Sourcepub const fn permissive() -> Self
pub const fn permissive() -> Self
Permissive limits for trusted input where large documents are expected: 256 MiB total, ~16.7 M records, 65 536 fields per record, 16 MiB per field.
Sourcepub const fn max_input_bytes(&self) -> usize
pub const fn max_input_bytes(&self) -> usize
The maximum number of input bytes.
Sourcepub const fn max_records(&self) -> usize
pub const fn max_records(&self) -> usize
The maximum number of records.
Sourcepub const fn max_fields_per_record(&self) -> usize
pub const fn max_fields_per_record(&self) -> usize
The maximum number of fields in any one record.
Sourcepub const fn max_field_bytes(&self) -> usize
pub const fn max_field_bytes(&self) -> usize
The maximum number of bytes in any one field (after unescaping).
Sourcepub const fn with_max_input_bytes(self, value: usize) -> Self
pub const fn with_max_input_bytes(self, value: usize) -> Self
Returns a copy with max_input_bytes set.
Sourcepub const fn with_max_records(self, value: usize) -> Self
pub const fn with_max_records(self, value: usize) -> Self
Returns a copy with max_records set.
Sourcepub const fn with_max_fields_per_record(self, value: usize) -> Self
pub const fn with_max_fields_per_record(self, value: usize) -> Self
Returns a copy with max_fields_per_record set.
Sourcepub const fn with_max_field_bytes(self, value: usize) -> Self
pub const fn with_max_field_bytes(self, value: usize) -> Self
Returns a copy with max_field_bytes set.