Skip to main content

write

Function write 

Source
pub fn write(
    model: &Model,
    roots: &[Shape],
    options: WriteOptions,
) -> OgeomResult<String>
Expand description

Write a model, and the shapes it is a document about.

roots are recorded so a reader gets back the same handles the writer had. A model with no roots is legal (it is a document of loose geometry), but a reader then has nothing to start a traversal from.

With roots, the file holds what they reach: their nodes, geometry and placements, and the provenance entries of the identities those nodes carry with every entity those entries derive from. Every lineage query on the written shapes answers as it did in model. With no roots, the whole model is written.

ยงErrors

OgeomError::Construction if the model holds something this does not know how to write, which is refused rather than dropped, or if a root does not resolve in the model.