#Why can I declare a type in one file, but not an identical type in another file?

23 messages · Page 1 of 1 (latest)

worn basin
#

For reference: rust is perfectly happy now:

#

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?

peak notch
#

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

worn basin
peak notch
#

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`
worn basin
#

this is the definition of that Asset by the way

peak notch
#

oh i see, it's a Handle that makes it an Asset

#

that's weird

worn basin
peak notch
#

basically, Handle itself seems to use the Asset trait

#

so in that sense, yes

worn basin
peak notch
#

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.

worn basin
#

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?

peak notch
#

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

worn basin
peak notch
#

that is weird