Struct tz::internals::Limits [] [src]

pub struct Limits {
    pub max_transitions: Option<u32>,
    pub max_local_time_types: Option<u32>,
    pub max_abbreviation_chars: Option<u32>,
    pub max_leap_seconds: Option<u32>,
}

Maximum numbers of structures that can be loaded from a time zone data file. If more than these would be loaded, an error will be returned instead.

Why have limits? Well, the header portion of the file (see Header) specifies the numbers of structures that should be read as a u32 four-byte integer. This means that an invalid (or maliciously-crafted!) file could try to read gigabytes of data while trying to read time zone information. To prevent this, reasonable defaults are set, although they can be turned off if necessary.

Fields

max_transitions: Option<u32>

Maximum number of transition structures

max_local_time_types: Option<u32>

Maximum number of local time type structures

max_abbreviation_chars: Option<u32>

Maximum number of characters (bytes, technically) in timezone abbreviations

max_leap_seconds: Option<u32>

Maximum number of leap second specifications

Methods

impl Limits
[src]

fn none() -> Limits

No size limits. This might use lots of memory when reading an invalid file, so be careful.

fn sensible() -> Limits

A reasonable set of default values that pose no danger of using lots of memory.

These values are taken from tz_file.h, at [ftp://ftp.iana.org/tz/code/tzfile.h].

fn verify(self, header: &Header) -> Result<()>

Makes sure the values we just read from the header are within this set of limits. Returns Ok(()) if everything is within the limits, and a boxed Error if at least one count is over.

Trait Implementations

impl Clone for Limits
[src]

fn clone(&self) -> Limits

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for Limits
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.