concision_core/traits/init.rs
1/*
2 Appellation: init <module>
3 Contrib: @FL03
4*/
5
6/// A trait for creating custom initialization routines for models or other entities.
7pub trait Init {
8 /// consumes the current instance to initialize a new one
9 fn init(self) -> Self
10 where
11 Self: Sized;
12}
13
14/// This trait enables models to implement custom, in-place initialization methods.
15pub trait InitInplace {
16 /// initialize the object in-place and return a mutable reference to it.
17 fn init_inplace(&mut self) -> &mut Self;
18}