Trait dbn::record::Record

source ·
pub trait Record {
    // Required method
    fn header(&self) -> &RecordHeader;

    // Provided methods
    fn record_size(&self) -> usize { ... }
    fn rtype(&self) -> Result<RType> { ... }
    fn publisher(&self) -> Result<Publisher> { ... }
    fn raw_index_ts(&self) -> u64 { ... }
    fn index_ts(&self) -> Option<OffsetDateTime> { ... }
    fn index_date(&self) -> Option<Date> { ... }
}
Expand description

Used for polymorphism around types all beginning with a RecordHeader where rtype is the discriminant used for indicating the type of record.

Required Methods§

source

fn header(&self) -> &RecordHeader

Returns a reference to the RecordHeader that comes at the beginning of all record types.

Provided Methods§

source

fn record_size(&self) -> usize

Returns the size of the record in bytes.

source

fn rtype(&self) -> Result<RType>

Tries to convert the raw record type into an enum which is useful for exhaustive pattern matching.

§Errors

This function returns an error if the rtype field does not contain a valid, known RType.

source

fn publisher(&self) -> Result<Publisher>

Tries to convert the raw publisher_id into an enum which is useful for exhaustive pattern matching.

§Errors

This function returns an error if the publisher_id does not correspond with any known Publisher.

source

fn raw_index_ts(&self) -> u64

Returns the raw primary timestamp for the record.

This timestamp should be used for sorting records as well as indexing into any symbology data structure.

source

fn index_ts(&self) -> Option<OffsetDateTime>

Returns the primary timestamp for the record. Returns None if the primary timestamp contains the sentinel value for a null timestamp.

This timestamp should be used for sorting records as well as indexing into any symbology data structure.

source

fn index_date(&self) -> Option<Date>

Returns the primary date for the record; the date component of the primary timestamp (index_ts()). Returns None if the primary timestamp contains the sentinel value for a null timestamp.

Implementors§