I tried to filter the types by TypeId::of::<T>() == TypeId::of::<u8> but this is restricted to 'static lifetimes only. I also tried to filter by mem::size_of == 1 but this gives my false positives on bool at least.
I don't mind to implement the trait for all built-in primitive types if that helps, but I don't want to implement this for every type.
I cant figure out how to get the value of isu8, I can do MyTrait::iu8 but that returns the constant true, self.isu8 is undefined(inside a method of the implementation). And how do you have to actually do the check? Just if self.isu8 and then the code for the u8 implementation?
PS sorry for the retracted post, I didnt know ctrl enter sends the post
It's a bit awkward with the double-negative impl on u8. It would be made a lot nicer if negative trait bounds were allowed (impl<T: !IsU8> MyTrait for T or impl MyTrait for !u8) but AFAICT there's no way to get this running at the moment.