From 01716fbdcfa701440b4704ee5dad7836c57df0f8 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Mon, 1 Sep 2014 13:39:54 -0700 Subject: [PATCH] SerializeState -> VisitorState --- serde2/src/bin.rs | 4 ++-- serde2/src/lib.rs | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/serde2/src/bin.rs b/serde2/src/bin.rs index b15594fa..3c0f6464 100644 --- a/serde2/src/bin.rs +++ b/serde2/src/bin.rs @@ -12,7 +12,7 @@ struct Foo { z: &'static str, } -impl, R> serde2::Serialize for Foo { +impl, R> serde2::Serialize for Foo { fn serialize(&self, state: &mut S) -> R { state.serialize_struct("Foo", FooSerialize { value: self, @@ -26,7 +26,7 @@ struct FooSerialize<'a> { state: uint, } -impl<'a, S: serde2::SerializeState, R> serde2::Visitor for FooSerialize<'a> { +impl<'a, S: serde2::VisitorState, R> serde2::Visitor for FooSerialize<'a> { fn visit(&mut self, state: &mut S) -> Option { match self.state { 0 => { diff --git a/serde2/src/lib.rs b/serde2/src/lib.rs index b94bfbaa..51a1f917 100644 --- a/serde2/src/lib.rs +++ b/serde2/src/lib.rs @@ -24,7 +24,7 @@ pub trait Visitor { } } -pub trait SerializeState { +pub trait VisitorState { fn serialize_int(&mut self, value: int) -> R; fn serialize_str(&mut self, value: &'static str) -> R; @@ -68,20 +68,20 @@ pub trait SerializeState { /////////////////////////////////////////////////////////////////////////////// -impl, R> Serialize for int { +impl, R> Serialize for int { fn serialize(&self, state: &mut S) -> R { state.serialize_int(*self) } } -impl, R> Serialize for &'static str { +impl, R> Serialize for &'static str { fn serialize(&self, state: &mut S) -> R { state.serialize_str(*self) } } impl< - S: SerializeState, + S: VisitorState, R, T: Serialize > Serialize for Vec { @@ -91,7 +91,7 @@ impl< } impl< - S: SerializeState, + S: VisitorState, R, K: Serialize + Ord, V: Serialize @@ -103,7 +103,7 @@ impl< impl< 'a, - S: SerializeState, + S: VisitorState, R, T0: Serialize, T1: Serialize @@ -120,7 +120,7 @@ struct Tuple2Serialize<'a, T0, T1> { impl< 'a, - S: SerializeState, + S: VisitorState, R, T0: Serialize, T1: Serialize @@ -151,7 +151,7 @@ impl< impl< 'a, - S: SerializeState, + S: VisitorState, R, T: Serialize > Serialize for &'a T { @@ -172,7 +172,7 @@ pub enum Token { End, } -pub trait TokenState: SerializeState { +pub trait TokenState: VisitorState { fn serialize(&mut self, token: Token) -> R; } @@ -200,7 +200,7 @@ impl TokenState<()> for GatherTokens { } } -impl SerializeState<()> for GatherTokens { +impl VisitorState<()> for GatherTokens { fn serialize_int(&mut self, value: int) -> () { self.serialize(Int(value)) } @@ -314,7 +314,7 @@ impl FormatState { } } -impl SerializeState> for FormatState { +impl VisitorState> for FormatState { fn serialize_int(&mut self, value: int) -> IoResult<()> { write!(self.writer, "{}", value) } @@ -438,7 +438,7 @@ impl JsonSerializer { } } -impl SerializeState for JsonSerializer { +impl VisitorState for JsonSerializer { fn serialize_int(&mut self, value: int) -> Json { Integer(value) }