1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use uniserde::{impls::core::reference::{BuilderRefValue, BuilderRefContext}, transform::build_from_ref}; #[test] fn demo() { let x = String::from("a"); // let y: &str = build_from_ref::<'_, 'static, BuilderRefValue<str>, _, _>(&*x).unwrap(); let y: &str = uniserde::transform::from_ref(&*x).unwrap(); dbg!(y); let y: &str = example(&&&&&&&*x); dbg!(y); // let y: &String = uniserde::transform::from(&*x).unwrap(); // dbg!(y); todo!(); } #[no_mangle] pub fn example<'a>(a: &&&&&&'a str) -> &'a str { // uniserde::transform::from(a).unwrap() build_from_ref::<BuilderRefContext<str>, _, _>(a).unwrap() } // default everything to value, have wrappers for context and static borrows