Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 7: ConvertSaveload requires serde as a dependency. #214

Open
Bobbias opened this issue Oct 25, 2023 · 1 comment
Open

Chapter 7: ConvertSaveload requires serde as a dependency. #214

Bobbias opened this issue Oct 25, 2023 · 1 comment

Comments

@Bobbias
Copy link

Bobbias commented Oct 25, 2023

While following along with chapter 7, I encountered a bunch of errors related to the use of the derive macro ConvertSaveload on the WantsToMelee component.

Further, nowhere in the tutorial does it explain that this will require serde as a dependency. I had to add the following to my cargo.toml:

[dependencies]
rltk = { git = "https://github.com/amethyst/bracket-lib" }
specs = { version = "0.17", features = ["serde"] } # added features = "serde"
serde = "1.0" # added serde dependency

Using the git version of rltk as per amethyst/bracket-lib#301
I also had to manually add the following additional imports:

use specs::saveload::{ConvertSaveload, Marker};
use specs::error::NoError;
use serde::{Serialize, Deserialize};

Failing to do so results in a series of complaints that various traits cannot be found. I'm still pretty new to rust, but I get the feeling that I shouldn't need to manually bring all of these traits into scope. I assume that this is the result of something not quite working right on the side of specs or specs-derive.

My suggestion would be to either remove the use of ConvertSaveload, or add clear instructions detailing the additional changes necessary to compile from that point on.

@dholmes215
Copy link

I also encountered this, and dealt with it as described, but then noticed that while ConvertSaveLoad appears in the text of that page, it does NOT appear in the actual source code for the chapter:

#[derive(Component, Debug, Clone)]

The actual dependency isn't added until chapter 11, where the tutorial says to add it to Cargo.toml:

https://bfnightly.bracketproductions.com/rustbook/chapter_11.html#including-serde

There are several other problems with that chapter as well, where typing the code as shown in the order it's shown does not actually compile until other changes later in the page,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants