♻️ Rename `StringSink` to `SinkString`

main
pantonshire 3 years ago
parent 8309e19a68
commit ac26dc3422

@ -175,9 +175,9 @@ pub fn percent_encode_to_buf<B>(buf: &mut String, bytes: &B)
where where
B: AsRef<[u8]> + ?Sized, B: AsRef<[u8]> + ?Sized,
{ {
use crate::{convert::result_elim, sink::StringSink}; use crate::{convert::result_elim, sink::SinkString};
let sink = StringSink::from_string_mut(buf); let sink = SinkString::from_string_mut(buf);
result_elim(percent_encode_to(sink, bytes)) result_elim(percent_encode_to(sink, bytes))
} }

@ -30,7 +30,7 @@ where
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub use string_sink::StringSink; pub use string_sink::SinkString;
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
mod string_sink { mod string_sink {
@ -43,9 +43,9 @@ mod string_sink {
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub struct StringSink(pub String); pub struct SinkString(pub String);
impl StringSink { impl SinkString {
#[inline] #[inline]
#[must_use] #[must_use]
pub fn from_string_ref(s: &String) -> &Self { pub fn from_string_ref(s: &String) -> &Self {
@ -65,21 +65,21 @@ mod string_sink {
} }
} }
impl AsRef<StringSink> for String { impl AsRef<SinkString> for String {
#[inline] #[inline]
fn as_ref(&self) -> &StringSink { fn as_ref(&self) -> &SinkString {
StringSink::from_string_ref(self) SinkString::from_string_ref(self)
} }
} }
impl AsMut<StringSink> for String { impl AsMut<SinkString> for String {
#[inline] #[inline]
fn as_mut(&mut self) -> &mut StringSink { fn as_mut(&mut self) -> &mut SinkString {
StringSink::from_string_mut(self) SinkString::from_string_mut(self)
} }
} }
impl StrSink for StringSink { impl StrSink for SinkString {
type Error = Infallible; type Error = Infallible;
#[inline] #[inline]

Loading…
Cancel
Save