In the below, specifically in call to from_glib_full, all types to the best of my knowledge are known:
The arg to the call is *mut gtk::Socket and the return type is *mut GtkSocket. Yet, I'm getting error.
let gtk_socket: *mut gtk::Socket = pointer as *mut _ as *mut gtk::Socket;
let gtksocket: *mut GtkSocket = from_glib_full(gtk_socket).unwrap();
Error:
let gtk_socket: *mut GtkSocket = from_glib_full(gtk_socket).unwrap();
| ^^^^^^^^^^^^^^ cannot infer type for type parameter T declared on the function from_glib_full
Okay, then - what is FromGlibPtrFull implemented for? You're unwrapping the result of from_glib_full call, that hints on something like Result, but since we don't know the trait, we don't know for sure what kind of Result (or probably Option) it is.
The code in the OP is equivalent (modulo lifetime of temporaries) to this:
let gtk_socket: *mut gtk::Socket = pointer as *mut _ as *mut gtk::Socket;
let tmp: T = from_glib_full(gtk_socket);
let gtksocket: *mut GtkSocket = tmp.unwrap();
unwrap knows, of course, but from_glib_full doesn't. All that it knows is that the target type implements FromGlibPtrFull<*mut gtk::Socket> - that's not enough.
Without knowing the available implementations for FromGlibPtrFull<*mut gtk::Socket> (or at lease the crate where it's from, if it's in the dependency) - I'm afraid not. The obvious way is to just drop unwrap(), since by your code it looks like from_glib_full would already return what you need, but I guess that there's something we don't know that makes this impossible.