in serde-reflection/src/format.rs [549:598]
fn visit_mut(&mut self, f: &mut dyn FnMut(&mut Format) -> Result<()>) -> Result<()> {
match self {
Self::Variable(variable) => {
variable.visit_mut(f)?;
// At this point, `variable` is known and points to variable-free content.
// Remove the variable.
*self = std::mem::take(variable)
.into_inner()
.expect("variable is known");
}
Self::TypeName(_)
| Self::Unit
| Self::Bool
| Self::I8
| Self::I16
| Self::I32
| Self::I64
| Self::I128
| Self::U8
| Self::U16
| Self::U32
| Self::U64
| Self::U128
| Self::F32
| Self::F64
| Self::Char
| Self::Str
| Self::Bytes => (),
Self::Option(format)
| Self::Seq(format)
| Self::TupleArray {
content: format, ..
} => {
format.visit_mut(f)?;
}
Self::Map { key, value } => {
key.visit_mut(f)?;
value.visit_mut(f)?;
}
Self::Tuple(formats) => {
for format in formats {
format.visit_mut(f)?;
}
}
}
f(self)
}