What is the cost of a `with_*()` method?

58 points krabsticks64

Hello! I was wondering, if I have a method like:

pub fn with_field(mut self, value: u32) -> Self {
    self.field = value;
    self
}

would rust always be able to optimize it? or would it sometimes be copied? (assuming we're compiling with optimizations, and the type is sufficiently big, such that copying it is non trivial).