I read online some talk about being about to expose methods of a composed object. In the following simplified example, is there a way to call foo.SetFocus() without having to type foo.control.window.SetFocus() so that we can save some typing and avoid exposing implementation details?
struct Window {
hwnd : u32,
}
impl Window {
pub fn SetFocus ( self ) {
unsafe blah blah blah
}
}
struct Control {
window : Window,
}
struct ListBox {
control : Control,
}
let foo = ListBox::new();
foo.control.window.SetFocus();
I know this is an XY problem, but I'm asking this question specifically because I'm still learning rust and I want/need to understand it's finer points.