Skip to main content

LogBufferRecords

Trait LogBufferRecords 

Source
pub trait LogBufferRecords {
    // Required methods
    fn record_count(&self) -> usize;
    fn encode_record(&self, index: usize, buf: &mut BytesMut);
    fn record_identity(&self, index: usize) -> LogRecordIdentity;

    // Provided methods
    fn record_position(&self, sequence_number: u64) -> Option<usize> { ... }
    fn timestamp_order(&self) -> TimestampOrder { ... }
}
Expand description

A log object’s Log_Buffer as ReadRange pages it: the resident records, oldest first, each framed on demand as its Clause 21 record production, with the identity ReadRange selects it by.

The records align element for element with crate::traits::BACnetObject::log_record_identities_internal. A page encodes only the records it visits, and the built-in logs find them without walking the whole buffer, so a narrow window over a full log stays cheap (#1536).

Required Methods§

Source

fn record_count(&self) -> usize

The number of resident records.

Source

fn encode_record(&self, index: usize, buf: &mut BytesMut)

Append the record at index (0 is the oldest) to buf.

Encoding cannot fail: the built-in logs refuse a record that would not encode when it is added, and an implementation must keep that promise too. Panics when index is not below record_count.

Source

fn record_identity(&self, index: usize) -> LogRecordIdentity

The identity of the record at index (0 is the oldest). Panics when index is not below record_count.

Provided Methods§

Source

fn record_position(&self, sequence_number: u64) -> Option<usize>

The index of the resident record numbered sequence_number, or None when no resident record has that number.

The default visits every record. The built-in logs number their records consecutively and compute the index instead.

Source

fn timestamp_order(&self) -> TimestampOrder

Whether every resident timestamp is an actual moment, and if so whether they run in order, which lets a search by time bisect them.

The default visits every record. The built-in logs keep the answer up to date as records come and go.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§