untrusted_outputs/untrusted_outputs.rs
1use std::any::Any;
2use untrusted_value::derive::untrusted_output;
3use untrusted_value::UntrustedValue;
4
5// Some function inside other library
6#[cfg_attr(feature = "derive", untrusted_output)]
7fn some_lib_func() -> String {
8 // if cfg matches, then use untrusted_output to wrap the
9 // function output in UntrustedValue
10
11 "abcdef".to_string()
12}
13
14fn main() {
15 // call library function
16 assert_eq!(
17 some_lib_func().type_id(),
18 UntrustedValue::wrap("test".to_string()).type_id()
19 );
20}