I am writing a tool, where logging is a mechanism that's used by all parts of the tool but centrally stored.
this is how i handle draw, networking and logging.
struct log <'a> {
messages: &'a mut Vec<String>,
}
struct draw <'a> {
i: u32,
l: &'a mut log<'a>,
}
struct net <'a> {
i: u32,
l: &'a mut log<'a>,
}
draw and networking, uses logging as a reference, as i have created methods centrally to log data and log file is also same for the entire liefcycle. However, according to Rust mutability and sharing design, I cannot implement this pattern. Is thers something I am missing, or is there another way of doing this?