MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/splashsurf / RealConvert

Interface RealConvert

splashsurf_lib/src/traits.rs:204–216  ·  view source on GitHub ↗

Trait for converting values, matrices, etc. from one `Real` type to another.

Source from the content-addressed store, hash-verified

202
203/// Trait for converting values, matrices, etc. from one `Real` type to another.
204pub trait RealConvert: Sized {
205 type Out<To>
206 where
207 To: Real;
208
209 /// Tries to convert this value to the target type, returns `None` if value cannot be represented by the target type
210 fn try_convert<To: Real>(self) -> Option<Self::Out<To>>;
211 /// Converts this value to the target type, panics if value cannot be represented by the target type
212 #[inline]
213 fn convert<To: Real>(self) -> Self::Out<To> {
214 self.try_convert().expect("failed to convert")
215 }
216}
217
218impl<From: Real> RealConvert for &From {
219 type Out<To>

Callers

nothing calls this directly

Implementers 1

traits.rssplashsurf_lib/src/traits.rs

Calls

no outgoing calls

Tested by

no test coverage detected