Yes, you can use raw pointers. Example at
https://play.rust-lang.org/?version=stable&mode=debug&editio.... The gist is
trait TryConvertValue: Sized {
/// SAFETY: `value` must be dereferencable.
unsafe fn try_convert_value(value: *const Value) -> Option<Self>;
}
Now `TryConvertValue` has no lifetime so you don't get the HRTB issues presented in the rest of the article. The unsafeness is that if you call `try_convert_value(null())` or with a dead raw pointer you will cause UB.
One issue with raw pointers though is that they don't extend to lifetime-generic types: there's no raw-pointer equivalent for
#[derive(Debug)]
enum Value<'a> {
String(&'a str),
Number(&'a i64),
}
trait TryConvertValue<'a>: Sized {
fn try_convert_value(value: Value<'a>) -> Option<Self>;
}
I wish there was a feature where you could use raw pointers in generic argument position, like `Value<
>` which would have variants `String(const str)`, `Number(*const i64)`, but I haven't heard anyone else suggest or advocate for it (`Value<'static>` is not the same)