Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(toml): Simplify upgrade path #472

Merged
merged 1 commit into from
Jan 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions crates/toml/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,51 @@ impl<'d> Serializer<'d> {
ser.settings.multiline_array = true;
ser
}

#[doc(hidden)]
#[deprecated(
since = "0.6.0",
note = "string behavior is now automatic; for greater control deserialize to `toml_edit::Document` and use `toml_edit::visit_mut::VisitorMut`"
)]
pub fn pretty_string(&mut self, _value: bool) -> &mut Self {
self
}

#[doc(hidden)]
#[deprecated(
since = "0.6.0",
note = "string behavior is now automatic; for greater control deserialize to `toml_edit::Document` and use `toml_edit::visit_mut::VisitorMut`"
)]
pub fn pretty_string_literal(&mut self, _value: bool) -> &mut Self {
self
}

#[doc(hidden)]
#[deprecated(
since = "0.6.0",
note = "this is bundled in with `pretty`; for greater control deserialize to `toml_edit::Document` and use `toml_edit::visit_mut::VisitorMut`"
)]
pub fn pretty_array(&mut self, _value: bool) -> &mut Self {
self
}

#[doc(hidden)]
#[deprecated(
since = "0.6.0",
note = "this is bundled in with `pretty`; for greater control deserialize to `toml_edit::Document` and use `toml_edit::visit_mut::VisitorMut`"
)]
pub fn pretty_array_indent(&mut self, _value: usize) -> &mut Self {
self
}

#[doc(hidden)]
#[deprecated(
since = "0.6.0",
note = "this is bundled in with `pretty`; for greater control deserialize to `toml_edit::Document` and use `toml_edit::visit_mut::VisitorMut`"
)]
pub fn pretty_array_trailing_comma(&mut self, _value: bool) -> &mut Self {
self
}
}

impl<'d> serde::ser::Serializer for Serializer<'d> {
Expand Down Expand Up @@ -1020,3 +1065,24 @@ fn write_value(

Ok(())
}

#[doc(hidden)]
#[deprecated(
since = "0.6.0",
note = "`tables_last` is no longer needed; things just work"
)]
pub fn tables_last<'a, I, K, V, S>(data: &'a I, serializer: S) -> Result<S::Ok, S::Error>
where
&'a I: IntoIterator<Item = (K, V)>,
K: serde::ser::Serialize,
V: serde::ser::Serialize,
S: serde::ser::Serializer,
{
use serde::ser::SerializeMap;

let mut map = serializer.serialize_map(None)?;
for (k, v) in data {
map.serialize_entry(&k, &v)?;
}
map.end()
}