Can't find GIO TcpWrapperConnection

Trying cast the subject:

cannot find type `TcpWrapperConnection` in crate `gio`
not found in `gio`
[dependencies.gio]
package = "gio"
version = "0.20.4"
features = ["v2_70"]

It is not implemented or I don't understand something?

Be sure to look at the doc for the Rust API. I'm guessing you want:

1 Like

Thanks for reply, I'm just trying to extract / cast TlsClientConnection from SocketConnection (when set_tls is true) according to documentation:

Note that since GSocketClient must return a GSocketConnection, but GTlsClientConnection is not a GSocketConnection, this actually wraps the resulting GTlsClientConnection in a GTcpWrapperConnection when returning it. You can use g_tcp_wrapper_connection_get_base_io_stream() on the return value to extract the GTlsClientConnection

GTcpConnection is option for SocketClient::set_tls is false,
when it set as true, downcast type should be GTcpWrapperConnection:

IOStream { inner: TypedObjectRef { inner: 0x5560f6427370, type: GTcpWrapperConnection } }

Maybe call this method?:

This would probably be easier for me if you show the code that produces the error along with the full error. (That is always a good idea when asking for help.)

1 Like

I don't understand how does GTK organize it API inside, but seems there is no way to cast to that data type, but I should just create new TlsClientConnection wrapper for IOStream available, e.g.

TlsClientConnection::new(base_io_stream, server_identity)
  • where base_io_stream could be received from existing SocketConnection object

About TcpWrapperConnection I don't know what is that, forgive.

That is what I suggested.

1 Like