ply_rs::ply

Struct ElementDef

Source
pub struct ElementDef {
    pub name: String,
    pub count: usize,
    pub properties: KeyMap<PropertyDef>,
}
Expand description

Models the definition of an element.

Elements describe single entities consisting of different properties. A single point is an element. We might model it as consisting of three coordinates: x, y, and z. Usually, one finds a list of elements in a ply file.

Fields§

§name: String

Name of the element.

Each element within a PLY file needs a unique name. There are common conventions like using “vertex” and “face” to assure interoperability between applications. For further information, please consult your target applications or the original specification.

§count: usize

Describes, how many elements appear in a PLY file.

The count is used when reading since we need to know how many elements we should interprete as having this type. The count is also needed for writing, since it will be written to the header.

§properties: KeyMap<PropertyDef>

An element is modeled by multiple properties, those are named values or lists.

§Examples

  • Point: We can define a point by its three coordinates. Hence we have three properties: x, y, and z. Reasonable types would be float or double.
  • Polygon: A polygon can be defined as a list of points. Since the points are stored in a list, we can define a list of indices. Good types would be some of the unsigned integer lists.

Implementations§

Source§

impl ElementDef

Source

pub fn new(name: String) -> Self

Creates a new element definition.

The name should be unique for each element in a PLY file.

You should never need to set count manuall, since it is set by the consistency check (see make_consistent() of Ply).

No properties are set.

Trait Implementations§

Source§

impl Clone for ElementDef

Source§

fn clone(&self) -> ElementDef

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 ElementDef

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Key for ElementDef

Source§

fn get_key(&self) -> String

Returns a key under which the element should be stored in a key-value store.
Source§

impl PartialEq for ElementDef

Source§

fn eq(&self, other: &ElementDef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ElementDef

Source§

impl StructuralPartialEq for ElementDef

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§

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,

Source§

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>,

Source§

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>,

Source§

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.