Closed astrale-sharp closed 2 years ago
This is now completly working except for the method duplicate_graph_from which i cant seem to make compile as of right now... When you uncomment the code you get this error which is quite confusing
errors :
the method `map` exists for struct `gdnative::prelude::Instance<Interface>`, but its trait bounds were not satisfied
the following trait bounds were not satisfied:
`gdnative::object::bounds::RefImplBound: gdnative::object::bounds::SafeDeref<gdnative::prelude::RefCounted, gdnative::prelude::Shared>`
`gdnative::prelude::Instance<Interface>: std::iter::Iterator`
which is required by `&mut gdnative::prelude::Instance<Interface>: std::iter::Iterator`
No Rust experience, so just throwing random guesses in case something clicks:
duplicate_graph_from()
. I assume that was intentional, but was it? (Also, neither version matches the doc example, but maybe that's just due to gdscript -> rust magic.)Hey :) the new api doesn't require to have _owner as part of the signature anymore so I removed it on all methods when the rust version isn't sufficient, rustc kindly warns you (which it did with me and i updated so it's not the problem)
For some reason in the following code we can't use map anymore and i can't get my head around why, i dont understand the trait errors very well
let mut cast;
unsafe {
cast = source_instance
.to_object::<Reference>()
.unwrap()
.assume_safe()
.assume_shared();
}
match cast
.cast_instance::<Interface>()
.as_ref()
// .and_then(|reference| unsafe { reference.assume_safe() }.cast_instance::<Interface>())
.and_then(|interface| {
interface.map(|interface, _| {
self.dijkstra = interface.dijkstra.clone();
})
})
If you need it working, it currently works on this draft without duplicate_graph_from(), you'd have to
git clone https://github.com/astrale-sharp/Dijkstra_map_for_Godot-1
cargo run --release
target/release/libdijkstra_map_gd.so
to addons/dijkstra-map/Dijkstra_map_library/bin/ + your OS
Hope that's helping, ask if you need help with something!
Thanks for posting the workaround. If I get to the point where I can't put off the 3.5 upgrade anymore, I'll be sure to try it if it's not solved by then! I don't think I'm using duplicate_graph_from()
right now.
This PR does most of the work (untested) but i must have some of the new export syntax confused about #[methods] #[derive] etc.
start to resolve #111 but im stuck and i need help with errors i don't know how to resolve
note that the first commit just corrects some typos but im unsure how to make a separated PR