I'm trying to play around with the substrate node template example and add some custom structs around.
However, I get the following compilation error:
"cannot find type Vec in this scope"
And example of the struct being used (+ associated traits and where I'm importing them from) is:
use codec::{Encode, Decode};
use scale_info::TypeInfo;
// , WrapperTypeDecode, WrapperTypeEncode, TypeInfo
#[derive(Encode, Decode, Default, Clone, PartialEq, TypeInfo)]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct Image {
// Note: Consider changing to JPG compression in the future
pixels: Vec<Vec<(u8, u8, u8)>>,
height: u32,
width: u32
}
But given that substrate requires quite a lot of bootstrapping I can't provide a working example.
The one thing I tried is adding #[cfg(feature = "std")] which afacit should have enabled either the rust std or the std defined in the Cargo.toml, I'm honestly unsure which. But it didn't help.
My main question is... how do I fix this? What imports am I missing where?
My secondary more important question is why would this be happening? Inside the https://docs.substrate.io/tutorials/v3/kitties/pt1/ tutorial vec! and Vec seem to be used without any issues or further additions... Or rather, the one addition I see is #[cfg(feature = "std")] being used before all impl blocks that use vec! but not before using Vec. Why is this the case? Is this simply allowing a block to import anything from the rust std? Or does it refer to the std defined in the Cargo.toml ? Why would it be necessary for vec! but not Vec ?