Struct e57::Extension

source ·
pub struct Extension {
    pub namespace: String,
    pub url: String,
}
Expand description

Describes an E57 extension by name and URL.

The E57 specification includes an mechanism for extensions. Each extension has its own namespace in the XML section of the E57 file. Such extensions can for example specify custom point attributes or add additional metadata and custom binary blobs.

Every E57 parser must be able to ignore any unknown extensions. Some extensions are officially documented, others are proprietary and have no public documentation.

Since full extension support involves all kinds of XML operations, it can greatly increase the API of any E57 library. This library is using a more pragmatic approach and requires you to bring your own XML library. This allows the API of this library to stay small, focused and lightweight.

Extension features directly supported by this library are:

  • reading and defining of XML namespaces for extensions
  • reading and writing additional custom point attributes
  • reading and writing of binary blobs

Extensions that require specific XML parsing are possible. You need to load your E57 file and then call E57Reader::xml() method to get the full original XML string. This will return an UTF8 string that can be feed into an XML parser. This library is using roxmltree for lightweight XML parsing.

Extensions that require XML manipulation when writing E57 files are also possible. You need to first finishing writing all point clouds, images and binary blobs. Then when you are ready to call E57Writer::finalize() to write the XML section and close the file, you need to call E57Writer::finalize_customized_xml() instead. This allows you to supply a transformer that will receive the generated XML string and can manipulate it before its written into the file. Your code is responsible for parsing, modifying and serializing th XML again in a non-destructive way!

§Example Code

You can find a complete example for reading and writing E57 files with extensions in the automated tests of the library.

Fields§

§namespace: String

XML namespace name.

§url: String

XML namespace URL.

Implementations§

source§

impl Extension

source

pub fn new(namespace: &str, url: &str) -> Self

Intialize and return a new Extension structure with the given values.

Trait Implementations§

source§

impl Clone for Extension

source§

fn clone(&self) -> Extension

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Extension

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.