Intro: I'm pretty sure I'm going about this in a way that could eventually work out, but it's probably not the most idiomatic way to do this. So I thought I'd ask the question here (Because stack overflow loves to tag things like this as "open-ended").
Question: I'm trying to create a single trait bound definition that provides a central location for setting all required traits for a generic type used throughout a crate. Basically I'd like T throughout the crate to be a floating point number of arbitrary precision (
f64). So, I start with
T: Float, but then I find something that needs
Display or various other things, and eventually that list for
T stacks up. Further complicating it, all of my structs are built around a lifetime attached to
T, so now I have to add that in.
But then this all starts leading to further problems. Eventually the compiler says that the required lifetime is unused somewhere, thus leading to the need to put
marker::PhantomData in to provide a target for the lifetime. Which is managed easily enough by adding a
const PHANTOM_DATA to the trait. Then functions start asking about adding a
'static lifetime for input variables of type
T. And some IDE warnings are showing up, though the compiler doesn't complain about them (yet).
So... Am I on the right track, and should I just keep working out kinks that pop up? Or is there a better and simpler way to do this?