pub trait AsPositionMut: AsPosition {
// Required method
fn as_position_mut(&mut self) -> &mut Self::Position;
// Provided methods
fn transform<F>(&mut self, f: F)
where F: FnMut(&Self::Position) -> Self::Position { ... }
fn map_position<F>(self, f: F) -> Self
where Self: Sized,
F: FnMut(&Self::Position) -> Self::Position { ... }
}Expand description
Mutable positional data.
This trait exposes positional data for geometric types along with its immutable variant
AsPosition.
§Examples
Exposing mutable positional data for a vertex:
use nalgebra::{Point3, Vector3};
use theon::{AsPosition, AsPositionMut};
pub struct Vertex {
position: Point3<f64>,
normal: Vector3<f64>,
}
impl AsPosition for Vertex {
type Position = Point3<f64>;
fn as_position(&self) -> &Self::Position {
&self.position
}
}
impl AsPositionMut for Vertex {
fn as_position_mut(&mut self) -> &mut Self::Position {
&mut self.position
}
}Required Methods§
fn as_position_mut(&mut self) -> &mut Self::Position
Provided Methods§
fn transform<F>(&mut self, f: F)
fn map_position<F>(self, f: F) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.