How do I handle an FFI unsized type that could be owned or borrowed?
问题 c_strange_t is an opaque C type that is only seen behind a pointer. When wrapping this type, there are times when it is our responsibility to free memory using c_free_strange_t(*c_strange_t) , and other times when we are not responsible for freeing the data, we are only responsible for accurately controlling the lifetime. It would be ergonomic if this type could be mapped into 2 types in Rust that work in a similar way to str and String , where there is impl Deref<Target=str> for String . The