For complex types dput() may be your only option. But if your types are simple one of the other alternatives will be much more legible. Examples:
d <- data.frame(x = 1)
dput(d)
# structure(list(x = 1), class = "data.frame", row.names = c(NA,
# -1L))
cat(wrapr::draw_frame(d))
# d <- wrapr::build_frame(
# "x" |
# 1 )