You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm interested in space aware datastructures and just learning rust, I was wondering what does the U: AsRef<f64> means in the kdtree.rs file. Does it mean that there should be a generic parameter U that defaults to a slice of f64 items that are default implemented and functions like:
It means that the structure can hold the "point" data in any type as long as it implements AsRef<[f64]> AsRef is from https://doc.rust-lang.org/std/convert/trait.AsRef.html
That is a type that that can be seean as a &[f64]. There are a lot of types that can be seen as a slice of f64. Vec or Arrays or slices or any custom types that chooses to implement the trait. Does that make sense?
@Eh2406 oh, thanks, ye, just to see if I understood well, if I implement my own structure, with wathever fields, and then implement the trait, then I can store elements of that structure in the kdtree, sweet 😄
Hi,
I'm interested in space aware datastructures and just learning rust, I was wondering what does the
U: AsRef<f64>
means in thekdtree.rs
file. Does it mean that there should be a generic parameterU
that defaults to a slice off64
items that are default implemented and functions like:can be implemented to use a type
U
rather thanf64
?The text was updated successfully, but these errors were encountered: