Struct e57::E57Writer

source ·
pub struct E57Writer<T: Read + Write + Seek> { /* private fields */ }
Expand description

Main interface for creating and writing E57 files.

Implementations§

source§

impl<T: Write + Read + Seek> E57Writer<T>

source

pub fn new(writer: T, guid: &str) -> Result<Self>

Creates a new E57 generator from a writer that must also implement Read and Seek.

File::create() will not work as input because it only opens the file for writing. Most typical use cases should prefer E57Writer::from_file() over this constructor.

source

pub fn set_coordinate_metadata(&mut self, value: Option<String>)

Set optional coordinate metadata string (empty by default).

source

pub fn set_creation(&mut self, value: Option<DateTime>)

Set optional creation date time (empty by default).

source

pub fn add_pointcloud( &mut self, guid: &str, prototype: Vec<Record>, ) -> Result<PointCloudWriter<'_, T>>

Creates a new writer for adding a new point cloud to the E57 file.

source

pub fn add_blob(&mut self, reader: &mut dyn Read) -> Result<Blob>

Adds a new binary data section to the E57 file. This feature is only required for custom data and extensions!

source

pub fn add_image(&mut self, guid: &str) -> Result<ImageWriter<'_, T>>

Creates a new image writer for adding an image to the E57 file.

source

pub fn register_extension(&mut self, extension: Extension) -> Result<()>

Registers a new E57 extension used by this file.

source

pub fn finalize(&mut self) -> Result<()>

Needs to be called after adding all point clouds and images.

This will generate and write the XML metadata to finalize and complete the E57 file. Without calling this method before dropping the E57 file will be incomplete and invalid!

source

pub fn finalize_customized_xml( &mut self, transformer: impl Fn(String) -> Result<String>, ) -> Result<()>

Same as finalize() but with additional XML transformation step.

Allows customizing the XML data before its written into the E57 file. This is required for adding E57 extension data to the XML. The transformer receives an XML string and must return an XML string. The client is responsible for parsing, modifying and serializing th XML again in a non-destructive way. The E57 library will not validate the XML string before writing it into the E57 file! If the transformer fails, the finalization is aborted and any error is forwarded.

source§

impl E57Writer<File>

source

pub fn from_file(path: impl AsRef<Path>, guid: &str) -> Result<Self>

Creates an E57 writer instance from a Path.

Auto Trait Implementations§

§

impl<T> Freeze for E57Writer<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for E57Writer<T>
where T: RefUnwindSafe,

§

impl<T> Send for E57Writer<T>
where T: Send,

§

impl<T> Sync for E57Writer<T>
where T: Sync,

§

impl<T> Unpin for E57Writer<T>
where T: Unpin,

§

impl<T> UnwindSafe for E57Writer<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.