Trait goods::AssetBuild
source · [−]pub trait AssetBuild<B>: Asset {
fn build(
decoded: Self::Decoded,
builder: &mut B
) -> Result<Self, Self::BuildError>;
}
Expand description
Asset building trait.
Users should implement this trait for at least single choice of B
.
But it is highly recommended to implement this trait for wide choices of B
for improved composability.
Because composite asset will implement AssetBuild<B>
only for such types B
for which all components implement AssetBuild<B>
.
For example, if a reference of type T
is necessary to build the asset,
implementing AssetBuild<B> where B: Borrow<T>
(or BorrowMut<T>
if mutable reference is needed)
would be recommended.