Skip to content

Commit afcd069

Browse files
committed
fix doc tests
1 parent cd78539 commit afcd069

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

crates/bevy_reflect/src/serde/ser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,12 +624,12 @@ mod tests {
624624
#[cfg(feature = "debug_stack")]
625625
assert_eq!(
626626
error,
627-
ron::Error::Message("my custom deserialize error (stack: `i32`)".to_string())
627+
ron::Error::Message("my custom serialize error (stack: `i32`)".to_string())
628628
);
629629
#[cfg(not(feature = "debug_stack"))]
630630
assert_eq!(
631631
error,
632-
ron::Error::Message("my custom deserialize error".to_string())
632+
ron::Error::Message("my custom serialize error".to_string())
633633
);
634634
}
635635

crates/bevy_reflect/src/serde/ser/serializer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use serde::{ser::SerializeMap, Serialize, Serializer};
3636
/// ```
3737
/// # use core::any::Any;
3838
/// # use serde::Serialize;
39-
/// # use bevy_reflect::{Reflect, TypeData, TypeRegistry};
39+
/// # use bevy_reflect::{PartialReflect, Reflect, TypeData, TypeRegistry};
4040
/// # use bevy_reflect::serde::{ReflectSerializer, ReflectSerializerProcessor};
4141
/// #
4242
/// # #[derive(Debug, Clone, Reflect)]
@@ -76,7 +76,7 @@ use serde::{ser::SerializeMap, Serialize, Serializer};
7676
/// impl ReflectSerializerProcessor for HandleProcessor {
7777
/// fn try_serialize<S>(
7878
/// &self,
79-
/// value: &dyn crate::PartialReflect,
79+
/// value: &dyn PartialReflect,
8080
/// registry: &TypeRegistry,
8181
/// serializer: S,
8282
/// ) -> Result<Result<S::Ok, S>, S::Error>
@@ -109,9 +109,9 @@ use serde::{ser::SerializeMap, Serialize, Serializer};
109109
///
110110
/// let processor = HandleProcessor;
111111
/// let serializer = ReflectSerializer::with_processor(asset, type_registry, &processor);
112-
/// let ron_serializer = ron::Serializer::new(&mut asset_bytes, None);
112+
/// let mut ron_serializer = ron::Serializer::new(&mut asset_bytes, None)?;
113113
///
114-
/// serializer.serialize(serializer)?;
114+
/// serializer.serialize(&mut ron_serializer)?;
115115
/// Ok(asset_bytes)
116116
/// }
117117
/// ```
@@ -133,7 +133,7 @@ pub trait ReflectSerializerProcessor {
133133
///
134134
/// ```
135135
/// # use bevy_reflect::{TypeRegistration, TypeRegistry, PartialReflect};
136-
/// # use bevy_reflect::serde::ReflectDeserializerProcessor;
136+
/// # use bevy_reflect::serde::ReflectSerializerProcessor;
137137
/// # use core::any::TypeId;
138138
/// struct I32AsStringProcessor;
139139
///
@@ -156,7 +156,7 @@ pub trait ReflectSerializerProcessor {
156156
///
157157
/// if type_id == TypeId::of::<i32>() {
158158
/// let value_as_string = format!("{value:?}");
159-
/// serializer.serialize_str(value_as_string).map(Ok)
159+
/// serializer.serialize_str(&value_as_string).map(Ok)
160160
/// } else {
161161
/// Ok(Err(serializer))
162162
/// }
@@ -423,7 +423,7 @@ impl<P: ReflectSerializerProcessor> Serialize for TypedReflectSerializer<'_, P>
423423
return Ok(value);
424424
}
425425
Err(err) => {
426-
return Err(err);
426+
return Err(make_custom_error(err));
427427
}
428428
Ok(Err(serializer)) => serializer,
429429
}

0 commit comments

Comments
 (0)