#Why can I declare a type in one file, but not an identical type in another file?
23 messages · Page 1 of 1 (latest)
but, on another file, suddenly, this is not ok:
scratch that- even in the same file, it's not happy. Is there some rule that the Handle<T> cannot be owned by a struct?
scratch that- even in the same file, it's not happy. Is there some rule that the Handle<T> cannot be owned by a struct?
Apparently, Assets are required to implement Uuid. so like, somewhere you're presumably using those structs as an asset? try making a new struct you don't use anywhere and it should be able to own a Texture / Handle<Texture> no problem
Yes, I have done this, in screenshot 3
to be clear, this is the part that i think is saying assets must implement Uuid
--> ~\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_asset-0.8.0\src\handle.rs:106:8
|
106 | T: Asset,
| ^^^^^ required by this bound in `bevy::prelude::Handle`
this is the definition of that Asset by the way
am I understanding that by adding Handle into my struct as a member, it is now using a trait?
T in handle must use Asset
yep, that's what that says, T must be an Asset
and the other one says that Asset must implement TypeUuid. so if Texture doesn't implement that, it can't be an asset.
looking at the source, there is no mention of Asset in the texture.rs file- but implementations can exist outside of the same file the struct was defined in, right?
even though that would be mean and nasty?
i imagine on the Bevy side, you probably need some other type that like holds a texture and implements Asset
that's my guess tho, i have very little bevy experience
well, that's what is shocking me, is this same type is somehow valid:
that is weird