As a Java developper, I have trouble adapting to Rust\'s composition style of coding and can\'t figure out how one would write this (Java) code in Rust style.