Unabbreviated method naming
This commit is contained in:
parent
a5a04306f2
commit
4b06030666
@ -169,9 +169,9 @@ impl<T> Serialize for [T]
|
||||
{
|
||||
let mut seq = try!(serializer.serialize_seq(Some(self.len())));
|
||||
for e in self {
|
||||
try!(seq.serialize_elem(e));
|
||||
try!(seq.serialize_element(e));
|
||||
}
|
||||
seq.serialize_end()
|
||||
seq.end()
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,9 +186,9 @@ macro_rules! array_impls {
|
||||
{
|
||||
let mut seq = try!(serializer.serialize_seq_fixed_size($len));
|
||||
for e in self {
|
||||
try!(seq.serialize_elem(e));
|
||||
try!(seq.serialize_element(e));
|
||||
}
|
||||
seq.serialize_end()
|
||||
seq.end()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -249,9 +249,9 @@ impl<'a, I> Serialize for Iterator<I>
|
||||
};
|
||||
let mut seq = try!(serializer.serialize_seq(size));
|
||||
for e in iter {
|
||||
try!(seq.serialize_elem(e));
|
||||
try!(seq.serialize_element(e));
|
||||
}
|
||||
seq.serialize_end()
|
||||
seq.end()
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,9 +265,9 @@ macro_rules! serialize_seq {
|
||||
{
|
||||
let mut seq = try!(serializer.serialize_seq(Some(self.len())));
|
||||
for e in self {
|
||||
try!(seq.serialize_elem(e));
|
||||
try!(seq.serialize_element(e));
|
||||
}
|
||||
seq.serialize_end()
|
||||
seq.end()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -334,9 +334,9 @@ impl<A> Serialize for ops::Range<A>
|
||||
let len = iter::Step::steps_between(&self.start, &self.end, &A::one());
|
||||
let mut seq = try!(serializer.serialize_seq(len));
|
||||
for e in self.clone() {
|
||||
try!(seq.serialize_elem(e));
|
||||
try!(seq.serialize_element(e));
|
||||
}
|
||||
seq.serialize_end()
|
||||
seq.end()
|
||||
}
|
||||
}
|
||||
|
||||
@ -369,9 +369,9 @@ macro_rules! tuple_impls {
|
||||
{
|
||||
let mut tuple = try!(serializer.serialize_tuple($len));
|
||||
$(
|
||||
try!(tuple.serialize_elem(&self.$idx));
|
||||
try!(tuple.serialize_element(&self.$idx));
|
||||
)+
|
||||
tuple.serialize_end()
|
||||
tuple.end()
|
||||
}
|
||||
}
|
||||
)+
|
||||
@ -562,7 +562,7 @@ macro_rules! serialize_map {
|
||||
try!(map.serialize_key(k));
|
||||
try!(map.serialize_value(v));
|
||||
}
|
||||
map.serialize_end()
|
||||
map.end()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -682,7 +682,7 @@ impl Serialize for Duration {
|
||||
let mut state = try!(serializer.serialize_struct("Duration", 2));
|
||||
try!(state.serialize_field("secs", self.as_secs()));
|
||||
try!(state.serialize_field("nanos", self.subsec_nanos()));
|
||||
state.serialize_end()
|
||||
state.end()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,9 +183,9 @@ pub trait Serializer {
|
||||
/// ```rust
|
||||
/// let mut seq = self.serialize_seq(Some(value.len()))?;
|
||||
/// for b in value {
|
||||
/// seq.serialize_elem(b)?;
|
||||
/// seq.serialize_element(b)?;
|
||||
/// }
|
||||
/// seq.serialize_end()
|
||||
/// seq.end()
|
||||
/// ```
|
||||
fn serialize_bytes(self, value: &[u8]) -> Result<Self::Ok, Self::Error>;
|
||||
|
||||
@ -324,10 +324,10 @@ pub trait SerializeSeq {
|
||||
type Error: Error;
|
||||
|
||||
/// Serializes a sequence element.
|
||||
fn serialize_elem<T: Serialize>(&mut self, value: T) -> Result<(), Self::Error>;
|
||||
fn serialize_element<T: Serialize>(&mut self, value: T) -> Result<(), Self::Error>;
|
||||
|
||||
/// Finishes serializing a sequence.
|
||||
fn serialize_end(self) -> Result<Self::Ok, Self::Error>;
|
||||
fn end(self) -> Result<Self::Ok, Self::Error>;
|
||||
}
|
||||
|
||||
/// Returned from `Serializer::serialize_tuple`.
|
||||
@ -340,10 +340,10 @@ pub trait SerializeTuple {
|
||||
type Error: Error;
|
||||
|
||||
/// Serializes a tuple element.
|
||||
fn serialize_elem<T: Serialize>(&mut self, value: T) -> Result<(), Self::Error>;
|
||||
fn serialize_element<T: Serialize>(&mut self, value: T) -> Result<(), Self::Error>;
|
||||
|
||||
/// Finishes serializing a tuple.
|
||||
fn serialize_end(self) -> Result<Self::Ok, Self::Error>;
|
||||
fn end(self) -> Result<Self::Ok, Self::Error>;
|
||||
}
|
||||
|
||||
/// Returned from `Serializer::serialize_tuple_struct`.
|
||||
@ -356,10 +356,10 @@ pub trait SerializeTupleStruct {
|
||||
type Error: Error;
|
||||
|
||||
/// Serializes a tuple struct element.
|
||||
fn serialize_elem<T: Serialize>(&mut self, value: T) -> Result<(), Self::Error>;
|
||||
fn serialize_field<T: Serialize>(&mut self, value: T) -> Result<(), Self::Error>;
|
||||
|
||||
/// Finishes serializing a tuple struct.
|
||||
fn serialize_end(self) -> Result<Self::Ok, Self::Error>;
|
||||
fn end(self) -> Result<Self::Ok, Self::Error>;
|
||||
}
|
||||
|
||||
/// Returned from `Serializer::serialize_tuple_variant`.
|
||||
@ -372,10 +372,10 @@ pub trait SerializeTupleVariant {
|
||||
type Error: Error;
|
||||
|
||||
/// Serializes a tuple variant element.
|
||||
fn serialize_elem<T: Serialize>(&mut self, value: T) -> Result<(), Self::Error>;
|
||||
fn serialize_field<T: Serialize>(&mut self, value: T) -> Result<(), Self::Error>;
|
||||
|
||||
/// Finishes serializing a tuple variant.
|
||||
fn serialize_end(self) -> Result<Self::Ok, Self::Error>;
|
||||
fn end(self) -> Result<Self::Ok, Self::Error>;
|
||||
}
|
||||
|
||||
/// Returned from `Serializer::serialize_map`.
|
||||
@ -394,7 +394,7 @@ pub trait SerializeMap {
|
||||
fn serialize_value<T: Serialize>(&mut self, value: T) -> Result<(), Self::Error>;
|
||||
|
||||
/// Finishes serializing a map.
|
||||
fn serialize_end(self) -> Result<Self::Ok, Self::Error>;
|
||||
fn end(self) -> Result<Self::Ok, Self::Error>;
|
||||
}
|
||||
|
||||
/// Returned from `Serializer::serialize_struct`.
|
||||
@ -410,7 +410,7 @@ pub trait SerializeStruct {
|
||||
fn serialize_field<V: Serialize>(&mut self, key: &'static str, value: V) -> Result<(), Self::Error>;
|
||||
|
||||
/// Finishes serializing a struct.
|
||||
fn serialize_end(self) -> Result<Self::Ok, Self::Error>;
|
||||
fn end(self) -> Result<Self::Ok, Self::Error>;
|
||||
}
|
||||
|
||||
/// Returned from `Serializer::serialize_struct_variant`.
|
||||
@ -426,7 +426,7 @@ pub trait SerializeStructVariant {
|
||||
fn serialize_field<V: Serialize>(&mut self, key: &'static str, value: V) -> Result<(), Self::Error>;
|
||||
|
||||
/// Finishes serializing a struct variant.
|
||||
fn serialize_end(self) -> Result<Self::Ok, Self::Error>;
|
||||
fn end(self) -> Result<Self::Ok, Self::Error>;
|
||||
}
|
||||
|
||||
/// A wrapper type for iterators that implements `Serialize` for iterators whose items implement
|
||||
|
@ -159,7 +159,7 @@ fn serialize_tuple_struct(
|
||||
fields,
|
||||
impl_generics,
|
||||
false,
|
||||
quote!(_serde::ser::SerializeTupleStruct::serialize_elem),
|
||||
quote!(_serde::ser::SerializeTupleStruct::serialize_field),
|
||||
);
|
||||
|
||||
let type_name = item_attrs.name().serialize_name();
|
||||
@ -169,7 +169,7 @@ fn serialize_tuple_struct(
|
||||
quote! {
|
||||
let #let_mut __serde_state = try!(_serializer.serialize_tuple_struct(#type_name, #len));
|
||||
#(#serialize_stmts)*
|
||||
_serde::ser::SerializeTupleStruct::serialize_end(__serde_state)
|
||||
_serde::ser::SerializeTupleStruct::end(__serde_state)
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ fn serialize_struct(
|
||||
quote! {
|
||||
let #let_mut __serde_state = try!(_serializer.serialize_struct(#type_name, #len));
|
||||
#(#serialize_fields)*
|
||||
_serde::ser::SerializeStruct::serialize_end(__serde_state)
|
||||
_serde::ser::SerializeStruct::end(__serde_state)
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ fn serialize_tuple_variant(
|
||||
fields,
|
||||
generics,
|
||||
true,
|
||||
quote!(_serde::ser::SerializeTupleVariant::serialize_elem),
|
||||
quote!(_serde::ser::SerializeTupleVariant::serialize_field),
|
||||
);
|
||||
|
||||
let len = serialize_stmts.len();
|
||||
@ -386,7 +386,7 @@ fn serialize_tuple_variant(
|
||||
#variant_name,
|
||||
#len));
|
||||
#(#serialize_stmts)*
|
||||
_serde::ser::SerializeTupleVariant::serialize_end(__serde_state)
|
||||
_serde::ser::SerializeTupleVariant::end(__serde_state)
|
||||
}
|
||||
}
|
||||
|
||||
@ -433,7 +433,7 @@ fn serialize_struct_variant(
|
||||
#len,
|
||||
));
|
||||
#(#serialize_fields)*
|
||||
_serde::ser::SerializeStructVariant::serialize_end(__serde_state)
|
||||
_serde::ser::SerializeStructVariant::end(__serde_state)
|
||||
}
|
||||
}
|
||||
|
||||
@ -558,7 +558,7 @@ fn wrap_serialize_with(
|
||||
// Serialization of an empty struct results in code like:
|
||||
//
|
||||
// let mut __serde_state = try!(serializer.serialize_struct("S", 0));
|
||||
// _serde::ser::SerializeStruct::serialize_end(__serde_state)
|
||||
// _serde::ser::SerializeStruct::end(__serde_state)
|
||||
//
|
||||
// where we want to omit the `mut` to avoid a warning.
|
||||
fn mut_if(is_mut: bool) -> Option<Tokens> {
|
||||
|
@ -228,14 +228,14 @@ impl<'s, 'a, I> ser::SerializeSeq for &'s mut Serializer<'a, I>
|
||||
type Ok = ();
|
||||
type Error = Error;
|
||||
|
||||
fn serialize_elem<T>(&mut self, value: T) -> Result<(), Error>
|
||||
fn serialize_element<T>(&mut self, value: T) -> Result<(), Error>
|
||||
where T: Serialize
|
||||
{
|
||||
assert_eq!(self.tokens.next(), Some(&Token::SeqSep));
|
||||
value.serialize(&mut **self)
|
||||
}
|
||||
|
||||
fn serialize_end(self) -> Result<(), Error> {
|
||||
fn end(self) -> Result<(), Error> {
|
||||
assert_eq!(self.tokens.next(), Some(&Token::SeqEnd));
|
||||
Ok(())
|
||||
}
|
||||
@ -247,14 +247,14 @@ impl<'s, 'a, I> ser::SerializeTuple for &'s mut Serializer<'a, I>
|
||||
type Ok = ();
|
||||
type Error = Error;
|
||||
|
||||
fn serialize_elem<T>(&mut self, value: T) -> Result<(), Error>
|
||||
fn serialize_element<T>(&mut self, value: T) -> Result<(), Error>
|
||||
where T: Serialize
|
||||
{
|
||||
assert_eq!(self.tokens.next(), Some(&Token::TupleSep));
|
||||
value.serialize(&mut **self)
|
||||
}
|
||||
|
||||
fn serialize_end(self) -> Result<(), Error> {
|
||||
fn end(self) -> Result<(), Error> {
|
||||
assert_eq!(self.tokens.next(), Some(&Token::TupleEnd));
|
||||
Ok(())
|
||||
}
|
||||
@ -266,14 +266,14 @@ impl<'s, 'a, I> ser::SerializeTupleStruct for &'s mut Serializer<'a, I>
|
||||
type Ok = ();
|
||||
type Error = Error;
|
||||
|
||||
fn serialize_elem<T>(&mut self, value: T) -> Result<(), Error>
|
||||
fn serialize_field<T>(&mut self, value: T) -> Result<(), Error>
|
||||
where T: Serialize
|
||||
{
|
||||
assert_eq!(self.tokens.next(), Some(&Token::TupleStructSep));
|
||||
value.serialize(&mut **self)
|
||||
}
|
||||
|
||||
fn serialize_end(self) -> Result<(), Error> {
|
||||
fn end(self) -> Result<(), Error> {
|
||||
assert_eq!(self.tokens.next(), Some(&Token::TupleStructEnd));
|
||||
Ok(())
|
||||
}
|
||||
@ -285,14 +285,14 @@ impl<'s, 'a, I> ser::SerializeTupleVariant for &'s mut Serializer<'a, I>
|
||||
type Ok = ();
|
||||
type Error = Error;
|
||||
|
||||
fn serialize_elem<T>(&mut self, value: T) -> Result<(), Error>
|
||||
fn serialize_field<T>(&mut self, value: T) -> Result<(), Error>
|
||||
where T: Serialize
|
||||
{
|
||||
assert_eq!(self.tokens.next(), Some(&Token::EnumSeqSep));
|
||||
value.serialize(&mut **self)
|
||||
}
|
||||
|
||||
fn serialize_end(self) -> Result<(), Error> {
|
||||
fn end(self) -> Result<(), Error> {
|
||||
assert_eq!(self.tokens.next(), Some(&Token::EnumSeqEnd));
|
||||
Ok(())
|
||||
}
|
||||
@ -313,7 +313,7 @@ impl<'s, 'a, I> ser::SerializeMap for &'s mut Serializer<'a, I>
|
||||
value.serialize(&mut **self)
|
||||
}
|
||||
|
||||
fn serialize_end(self) -> Result<(), Self::Error> {
|
||||
fn end(self) -> Result<(), Self::Error> {
|
||||
assert_eq!(self.tokens.next(), Some(&Token::MapEnd));
|
||||
Ok(())
|
||||
}
|
||||
@ -331,7 +331,7 @@ impl<'s, 'a, I> ser::SerializeStruct for &'s mut Serializer<'a, I>
|
||||
value.serialize(&mut **self)
|
||||
}
|
||||
|
||||
fn serialize_end(self) -> Result<(), Self::Error> {
|
||||
fn end(self) -> Result<(), Self::Error> {
|
||||
assert_eq!(self.tokens.next(), Some(&Token::StructEnd));
|
||||
Ok(())
|
||||
}
|
||||
@ -349,7 +349,7 @@ impl<'s, 'a, I> ser::SerializeStructVariant for &'s mut Serializer<'a, I>
|
||||
value.serialize(&mut **self)
|
||||
}
|
||||
|
||||
fn serialize_end(self) -> Result<(), Self::Error> {
|
||||
fn end(self) -> Result<(), Self::Error> {
|
||||
assert_eq!(self.tokens.next(), Some(&Token::EnumMapEnd));
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user