src/instance.rs

branch
dev
changeset 88
086a59b3a2b4
parent 75
e9f4550cfa18
equal deleted inserted replaced
87:72968cf30033 88:086a59b3a2b4
87 } 87 }
88 88
89 /// Helper trait for functions to work with either owned values or references to either the 89 /// Helper trait for functions to work with either owned values or references to either the
90 /// “principal type” `X` or types some present a subset of `X`. In the latter sense, this 90 /// “principal type” `X` or types some present a subset of `X`. In the latter sense, this
91 /// generalises [`std::borrow::ToOwned`], [`std::borrow::Borrow`], and [`std::borrow::Cow`]. 91 /// generalises [`std::borrow::ToOwned`], [`std::borrow::Borrow`], and [`std::borrow::Cow`].
92 ///
93 /// This is used, for example, by [`crate::mapping::Mapping::apply`].
92 pub trait Instance<X : Space, D = <X as Space>::Decomp> : Sized where D : Decomposition<X> { 94 pub trait Instance<X : Space, D = <X as Space>::Decomp> : Sized where D : Decomposition<X> {
93 /// Decomposes self according to `decomposer`. 95 /// Decomposes self according to `decomposer`.
94 fn decompose<'b>(self) -> D::Decomposition<'b> 96 fn decompose<'b>(self) -> D::Decomposition<'b>
95 where Self : 'b, X : 'b; 97 where Self : 'b, X : 'b;
96 98

mercurial