Skip to content

Commit fc0d73a

Browse files
committed
Remove seemingly unnecessary section in chapter 14
1 parent 3efde2a commit fc0d73a

1 file changed

Lines changed: 1 addition & 31 deletions

File tree

book/src/chapter_14.md

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -177,37 +177,7 @@ pub struct Equipped {
177177
}
178178
```
179179

180-
Just like before, we need to register it in `main.rs`, and include it in the serialization and deserialization lists in `saveload_system.rs`. Since this includes an `Entity`, we'll also have a to include wrapper/helper code to make serialization work. The wrapper is a lot like others we've written - it converts `Equipped` into a tuple for save, and back again for loading:
181-
182-
```rust
183-
// Equipped wrapper
184-
#[derive(Serialize, Deserialize, Clone)]
185-
pub struct EquippedData<M>(M, EquipmentSlot);
186-
187-
impl<M: Marker + Serialize> ConvertSaveload<M> for Equipped
188-
where
189-
for<'de> M: Deserialize<'de>,
190-
{
191-
type Data = EquippedData<M>;
192-
type Error = NoError;
193-
194-
fn convert_into<F>(&self, mut ids: F) -> Result<Self::Data, Self::Error>
195-
where
196-
F: FnMut(Entity) -> Option<M>,
197-
{
198-
let marker = ids(self.owner).unwrap();
199-
Ok(EquippedData(marker, self.slot))
200-
}
201-
202-
fn convert_from<F>(data: Self::Data, mut ids: F) -> Result<Self, Self::Error>
203-
where
204-
F: FnMut(M) -> Option<Entity>,
205-
{
206-
let entity = ids(data.0).unwrap();
207-
Ok(Equipped{owner: entity, slot : data.1})
208-
}
209-
}
210-
```
180+
Just like before, we need to register it in `main.rs`, and include it in the serialization and deserialization lists in `saveload_system.rs`.
211181

212182
### Actually equipping the item
213183

0 commit comments

Comments
 (0)