This implements Default for the reference, not the struct itself. To create a reference from the thin air (not from the argument), you must have some 'static value somewhere to refer to - an actual static, a leaked Box, or something like that.
The problem is, as discussed, you cannot return a reference from a function that points into its own stack frame. You can create a reference in the caller's stack frame, instead.
How can I get and use is2.f2.f2 e.g. for println! while leaving other values as-is? If I use is2.f2.take() then is2.f2 will be left with default value, or if using .into_inner() then it consumes is2.f2.
Thanks, but I don;t want to make is2 mutable entirely. I need it immutable with just some mutable fields i.e. with Cell/RefCell. Although your get_f2 works, in fact I tried the same approach with the whole f2 i.e. create a temporary then get then set back, is there another way more elegant that we don't have to do that temporary variable trick?