Skip to main content

Limits

Struct Limits 

Source
#[non_exhaustive]
pub struct Limits {
Show 16 fields pub max_input_bytes: u64, pub max_units: usize, pub max_unit_chars: usize, pub max_lines: usize, pub max_xml_depth: usize, pub max_xml_elements: usize, pub max_zip_entries: usize, pub max_zip_bytes: u64, pub max_zip_entry_bytes: u64, pub max_zip_ratio: u64, pub zip_ratio_floor_bytes: u64, pub max_paragraphs: usize, pub xlsx_max_cells: usize, pub xlsx_max_rows: u32, pub xlsx_max_cell_chars: usize, pub xlsx_max_total_text_chars: usize,
}
Expand description

The limits one extraction runs under. Default is Localization OS’s configuration. Build them with Limits::new and the with_* methods (Limits::new().with_max_units(500)); new limits are added without breaking callers.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§max_input_bytes: u64

Largest input file (MAX_UPLOAD_BYTES).

§max_units: usize

Most units (and most segments) in a document (MAX_DOCUMENT_SEGMENTS).

§max_unit_chars: usize

Most characters in one unit (MAX_SEGMENT_CHARS).

§max_lines: usize

Most lines in a text file: twenty per allowed unit, as LocOS’s line budget.

§max_xml_depth: usize

Deepest XML element nesting (libxml2’s own default).

§max_xml_elements: usize

Most XML elements in one part.

§max_zip_entries: usize

Most entries in a zip (ZIP_MAX_MEMBERS).

§max_zip_bytes: u64

Most bytes all entries of a zip unpack to (ZIP_MAX_UNCOMPRESSED_BYTES).

§max_zip_entry_bytes: u64

Most bytes one zip entry may unpack to. LocOS has no cap of its own beyond the total, so the default is the same 256 MB; a caller may set it lower (or raise both for desktop use).

§max_zip_ratio: u64

Largest unpacked/packed ratio of one entry (ZIP_MAX_RATIO).

§zip_ratio_floor_bytes: u64

Entries smaller than this are not checked for ratio (ZIP_RATIO_MIN_BYTES).

§max_paragraphs: usize

Most paragraphs in a DOCX, empty ones included (DOCX_MAX_PARAGRAPHS).

§xlsx_max_cells: usize

Most cells in an XLSX (XLSX_MAX_CELLS).

§xlsx_max_rows: u32

Highest row number in an XLSX (XLSX_MAX_ROWS).

§xlsx_max_cell_chars: usize

Most characters in one XLSX cell or shared string (XLSX_MAX_CELL_CHARS, Excel’s own limit).

§xlsx_max_total_text_chars: usize

Most characters of cell text in an XLSX, repeated shared strings counted every time (XLSX_MAX_TOTAL_TEXT_CHARS).

Implementations§

Source§

impl Limits

Source

pub fn new() -> Limits

Localization OS’s limits (the same as Limits::default()); change any of them with the with_* methods.

Source

pub fn with_max_input_bytes(self, v: u64) -> Limits

Sets max_input_bytes.

Source

pub fn with_max_units(self, v: usize) -> Limits

Sets max_units.

Source

pub fn with_max_unit_chars(self, v: usize) -> Limits

Sets max_unit_chars.

Source

pub fn with_max_lines(self, v: usize) -> Limits

Sets max_lines.

Source

pub fn with_max_xml_depth(self, v: usize) -> Limits

Sets max_xml_depth.

Source

pub fn with_max_xml_elements(self, v: usize) -> Limits

Sets max_xml_elements.

Source

pub fn with_max_zip_entries(self, v: usize) -> Limits

Sets max_zip_entries.

Source

pub fn with_max_zip_bytes(self, v: u64) -> Limits

Sets max_zip_bytes.

Source

pub fn with_max_zip_entry_bytes(self, v: u64) -> Limits

Sets max_zip_entry_bytes.

Source

pub fn with_max_zip_ratio(self, v: u64) -> Limits

Sets max_zip_ratio.

Source

pub fn with_zip_ratio_floor_bytes(self, v: u64) -> Limits

Sets zip_ratio_floor_bytes.

Source

pub fn with_max_paragraphs(self, v: usize) -> Limits

Sets max_paragraphs.

Source

pub fn with_xlsx_max_cells(self, v: usize) -> Limits

Sets xlsx_max_cells.

Source

pub fn with_xlsx_max_rows(self, v: u32) -> Limits

Sets xlsx_max_rows.

Source

pub fn with_xlsx_max_cell_chars(self, v: usize) -> Limits

Sets xlsx_max_cell_chars.

Source

pub fn with_xlsx_max_total_text_chars(self, v: usize) -> Limits

Sets xlsx_max_total_text_chars.

Trait Implementations§

Source§

impl Clone for Limits

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Limits

Source§

impl Debug for Limits

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Limits

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Limits
where Limits: Default,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Limits

Source§

impl PartialEq for Limits

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Limits

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Limits

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.