pub struct StepReader { /* private fields */ }Expand description
A STEP codec carrying an explicit parse policy.
Implementations§
Source§impl StepReader
impl StepReader
Sourcepub const fn new(options: ParseOptions) -> Self
pub const fn new(options: ParseOptions) -> Self
A reader applying options.
Sourcepub const fn eager(self) -> Self
pub const fn eager(self) -> Self
Decodes every entity during the read, as before lazy loading.
For a consumer that will touch nearly every entity anyway and wants the source released after the read. Recovery and reference-check options always read eagerly.
Sourcepub unsafe fn read_path_mapped(&self, path: &Path) -> Result<Model, ModelError>
pub unsafe fn read_path_mapped(&self, path: &Path) -> Result<Model, ModelError>
Reads a memory-mapped file.
Avoids copying the file: pages are loaded from the page cache as they are touched and are not part of the process’s own heap. A lazily loaded model keeps the mapping and decodes from it for as long as it lives.
§Safety
The file must not be modified or truncated while the returned model
– or any clone of it – is alive. Truncation can end the process
with SIGBUS when an entity is decoded; a rewrite makes decoding
panic or, if the new bytes still parse, read other content. Prefer
Codec::read_path, which owns its copy, unless the file is known
to stay put.
§Errors
As Codec::read_path.
Sourcepub const fn on_malformed_record(self, policy: OnMalformed) -> Self
pub const fn on_malformed_record(self, policy: OnMalformed) -> Self
Sets the malformed-record policy.
Sourcepub const fn options(&self) -> ParseOptions
pub const fn options(&self) -> ParseOptions
The policy this reader applies.
Trait Implementations§
Source§impl Clone for StepReader
impl Clone for StepReader
Source§impl Codec for StepReader
impl Codec for StepReader
Source§fn read_path(&self, path: &Path) -> Result<Model, ModelError>
fn read_path(&self, path: &Path) -> Result<Model, ModelError>
Reads the file into a buffer the model owns.
Not memory-mapped: a lazily loaded model decodes from its source for
as long as it lives, and a mapping of a file that another process
changes in that time is undefined behaviour. The mapped read is
StepReader::read_path_mapped, an unsafe opt-in.