I'm trying to create a struct like this:
DeviceCapabilities {
max_transmission_unit: self.mtu,
..DeviceCapabilities::default()
}
Here's the struct definition:
#[derive(Debug, Clone, Default)]
pub struct DeviceCapabilities {
pub max_transmission_unit: usize,
pub max_burst_size: Option<usize>,
pub checksum: ChecksumCapabilities,
/// Only present to prevent people from trying to initialize every field of DeviceLimits,
/// which would not let us add new fields in the future.
dummy: ()
}
on the line DeviceCapabilities::default()
of ..DeviceCapabilities::default()
I get the following error:
field `dummy` of struct `smoltcp::phy::DeviceCapabilities` is private
First of all, why the field dummy is being filled, if the second one is max_burst_size
?
Actually the piece of code that instantiates the struct is from a library. There it works but in my library it does not. I understand that field dummy
is private as it has no pub
, but why it works in the other library?
Also what the ..
means? Maybe important to understand what's happening