Skip to content

Width computation semantics #20

Description

@alambert-lanl

This is related to #10

Currently, widths of all runtime dependent members are stored in OnceCells. However, this is overkill as most of these values are loaded during construction, save for self referential members.

My current proposed solution is the following

Definitions

If a member is a reader type or an optional reader, we simply store the reader/Optional. If a member is self referential, we don't store it.

get_{}_width

The current implementation shall be split into a private function that computes the width (by reading data from the buffer), called load_{dep}_width() and a public facing function called get_{dep}_width() which simply returns the width precomputed by load_{dep}_width or reader.get_width()

Constructor

Thus, the constructor shall look like

new(buf: &[u8]) -> Result<Self> {
    let mut me = Self {0};
    for dep in deps.in_order() {
        me.load_{dep}_width();
    }

   me.validate()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions