Struct ply_rs::writer::Writer [] [src]

pub struct Writer<E: PropertyAccess> { /* fields omitted */ }

Writes a Ply to a Write trait.

The simplest function to start with is write_ply(). It performs all necessary checks and writes a complete PLY file. Sometimes you might want to have better control over how much is written. All other write_ functions are for those cases. The trade-off is, that then you get responsible to write consistent data. See Ply::make_consistent().

For further information on the PLY file format, consult the official reference.

Examples

Simplest case of writing an entire PLY file en bloc:

// Get a Ply from somewhere
// let mut ply = ...;

// Get a buffer with `Write` trait.
// For example a file: let buf = std::io::File(".../your.ply").unwrap();

// Create a writer
let w = Writer::new();

// Write your data:
let written = w.write_ply(&mut buf, &mut ply).unwrap();

Methods

impl<E: PropertyAccess> Writer<E>
[src]

[src]

Create a new Writer<E> where E is the element type. To get started quickly use DefaultElement.

[src]

Writes an entire PLY file modeled by ply to out, performs consistency chekc.

ply must be mutable since a consistency check is performed. If problems can be corrected automatically, ply will be modified accordingly.

Returns number of bytes written.

[src]

Writes an entire PLY file modeled by ply to out, performes no consistency check.

Like write_ply but doesn't check the input for inconsistency. The user is responsible to provide a consistent Ply, if not, behaviour is undefined and might result in a corrupted output.

impl<E: PropertyAccess> Writer<E>
[src]

Header

[src]

Writes the magic number "ply" and a new line.

Each PLY file must start with "ply\n".

[src]

Writes "format ".

Each PLY file must define its format.

[src]

Writes a comment line.

A comment must not contain a line break and only consist of ascii characters.

[src]

Writes an object information line.

An object informatio line must not contain a line break an only consist of ascii characters.

[src]

Writes an element line from the header: "element "

This line is part of the header. It defines the format of an element. It is directly followed by its property definitions.

Make sure the header is consistent with the payload.

[src]

Writes a property line form the header: "property [list | ]"

Make sure the property definition is consistent with the payload.

[src]

Writes the element line and all the property definitions

Convenience method to call write_line_element_definition and write_line_property_definition in the correct way.

Make sure the element definition is consistent with the payload.

[src]

Writes end_header\n. This terminates the header. Each following byte belongs to the payload.

[src]

Convenience method to write all header elements.

It starts with writing the magic number "ply\n" and ends with "end_header".

Make sure the header is consistent with the payload.

impl<E: PropertyAccess> Writer<E>
[src]

Payload

[src]

Writes the payload of a ply (ply.playload).

Make sure the Header is consistent with the payload.

[src]

Write all elments as stored in the element_list.

Make sure the header and the element definition is consistent with the payload.

impl<E: PropertyAccess> Writer<E>
[src]

Ascii

[src]

Write a single ascii formatted element.

impl<E: PropertyAccess> Writer<E>
[src]

Binary

[src]

Write a single binary formatted element in big endian.

[src]

Write a single binary formatted element in little endian.