// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.SocketClient.html).
pub type SocketClient
///|
pub(open) trait ISocketClient {
fn as_socket_client(Self) -> SocketClient
fn add_application_proxy(Self, String) -> Unit = _
fn connect(Self, &ISocketConnectable, &ICancellable?) -> SocketConnection raise @glib.Error_ = _
fn connect_to_host(Self, String, UInt, &ICancellable?) -> SocketConnection raise @glib.Error_ = _
fn connect_to_service(Self, String, String, &ICancellable?) -> SocketConnection raise @glib.Error_ = _
fn connect_to_uri(Self, String, UInt, &ICancellable?) -> SocketConnection raise @glib.Error_ = _
fn get_enable_proxy(Self) -> Bool = _
fn get_family(Self) -> SocketFamily = _
fn get_local_address(Self) -> SocketAddress? = _
fn get_proxy_resolver(Self) -> ProxyResolver = _
fn get_socket_type(Self) -> SocketType = _
fn get_timeout(Self) -> UInt = _
fn get_tls(Self) -> Bool = _
fn set_enable_proxy(Self, Bool) -> Unit = _
fn set_family(Self, SocketFamily) -> Unit = _
fn set_local_address(Self, &ISocketAddress?) -> Unit = _
fn set_proxy_resolver(Self, &IProxyResolver?) -> Unit = _
fn set_socket_type(Self, SocketType) -> Unit = _
fn set_timeout(Self, UInt) -> Unit = _
fn set_tls(Self, Bool) -> Unit = _
fn connect_event(
Self,
(SocketClient, SocketClientEvent, SocketConnectable, IOStream?) -> Unit,
) -> UInt64 = _
fn connect_async(
Self,
&ISocketConnectable,
&ICancellable?,
(Result[SocketConnection, @glib.Error_]) -> Unit,
) -> Unit = _
fn connect_to_host_async(
Self,
String,
UInt,
&ICancellable?,
(Result[SocketConnection, @glib.Error_]) -> Unit,
) -> Unit = _
fn connect_to_service_async(
Self,
String,
String,
&ICancellable?,
(Result[SocketConnection, @glib.Error_]) -> Unit,
) -> Unit = _
fn connect_to_uri_async(
Self,
String,
UInt,
&ICancellable?,
(Result[SocketConnection, @glib.Error_]) -> Unit,
) -> Unit = _
}
///|
pub impl ISocketClient for SocketClient with fn as_socket_client(self) {
self
}
///|
/// Implementation contract for SocketClient.event. Self is the retained MoonBit state; the second parameter is the invoked SocketClient object.
pub(open) trait VSocketClientEvent {
fn event(
Self,
SocketClient,
SocketClientEvent,
&ISocketConnectable,
&IIOStream,
) -> Unit
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/ctor.SocketClient.new.html).
pub extern "c" fn SocketClient::new() -> SocketClient = "moonbit_g_socket_client_new"
///|
#borrow(self_, protocol)
extern "c" fn moonbit_g_socket_client_add_application_proxy(
self_ : SocketClient,
protocol : Bytes,
) = "moonbit_g_socket_client_add_application_proxy"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.add_application_proxy.html).
pub fn SocketClient::add_application_proxy(
self : SocketClient,
protocol : String,
) -> Unit {
moonbit_g_socket_client_add_application_proxy(
self,
@encoding/utf8.encode(protocol),
)
}
///|
#borrow(self_, connectable, cancellable, error)
extern "c" fn moonbit_g_socket_client_connect(
self_ : SocketClient,
connectable : SocketConnectable,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> SocketConnection = "moonbit_g_socket_client_connect"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.connect.html).
pub fn SocketClient::connect(
self : SocketClient,
connectable : &ISocketConnectable,
cancellable : &ICancellable?,
) -> SocketConnection raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_socket_client_connect(
self,
connectable.as_socket_connectable(),
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(self_, host_and_port, cancellable, error)
extern "c" fn moonbit_g_socket_client_connect_to_host(
self_ : SocketClient,
host_and_port : Bytes,
default_port : UInt,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> SocketConnection = "moonbit_g_socket_client_connect_to_host"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.connect_to_host.html).
pub fn SocketClient::connect_to_host(
self : SocketClient,
host_and_port : String,
default_port : UInt,
cancellable : &ICancellable?,
) -> SocketConnection raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_socket_client_connect_to_host(
self,
@encoding/utf8.encode(host_and_port),
default_port,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(self_, domain, service, cancellable, error)
extern "c" fn moonbit_g_socket_client_connect_to_service(
self_ : SocketClient,
domain : Bytes,
service : Bytes,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> SocketConnection = "moonbit_g_socket_client_connect_to_service"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.connect_to_service.html).
pub fn SocketClient::connect_to_service(
self : SocketClient,
domain : String,
service : String,
cancellable : &ICancellable?,
) -> SocketConnection raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_socket_client_connect_to_service(
self,
@encoding/utf8.encode(domain),
@encoding/utf8.encode(service),
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(self_, uri, cancellable, error)
extern "c" fn moonbit_g_socket_client_connect_to_uri(
self_ : SocketClient,
uri : Bytes,
default_port : UInt,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> SocketConnection = "moonbit_g_socket_client_connect_to_uri"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.connect_to_uri.html).
pub fn SocketClient::connect_to_uri(
self : SocketClient,
uri : String,
default_port : UInt,
cancellable : &ICancellable?,
) -> SocketConnection raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_socket_client_connect_to_uri(
self,
@encoding/utf8.encode(uri),
default_port,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.get_enable_proxy.html).
#borrow(self)
pub extern "c" fn SocketClient::get_enable_proxy(self : SocketClient) -> Bool = "moonbit_g_socket_client_get_enable_proxy"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.get_family.html).
#borrow(self)
pub extern "c" fn SocketClient::get_family(self : SocketClient) -> SocketFamily = "moonbit_g_socket_client_get_family"
///|
#borrow(self_)
extern "c" fn moonbit_g_socket_client_get_local_address(
self_ : SocketClient,
) -> @glib.Nullable[SocketAddress] = "moonbit_g_socket_client_get_local_address"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.get_local_address.html).
pub fn SocketClient::get_local_address(self : SocketClient) -> SocketAddress? {
let raw_result = moonbit_g_socket_client_get_local_address(self)
raw_result.to_option()
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.get_proxy_resolver.html).
#borrow(self)
pub extern "c" fn SocketClient::get_proxy_resolver(
self : SocketClient,
) -> ProxyResolver = "moonbit_g_socket_client_get_proxy_resolver"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.get_socket_type.html).
#borrow(self)
pub extern "c" fn SocketClient::get_socket_type(
self : SocketClient,
) -> SocketType = "moonbit_g_socket_client_get_socket_type"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.get_timeout.html).
#borrow(self)
pub extern "c" fn SocketClient::get_timeout(self : SocketClient) -> UInt = "moonbit_g_socket_client_get_timeout"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.get_tls.html).
#borrow(self)
pub extern "c" fn SocketClient::get_tls(self : SocketClient) -> Bool = "moonbit_g_socket_client_get_tls"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.set_enable_proxy.html).
#borrow(self)
pub extern "c" fn SocketClient::set_enable_proxy(
self : SocketClient,
enable : Bool,
) = "moonbit_g_socket_client_set_enable_proxy"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.set_family.html).
#borrow(self)
pub extern "c" fn SocketClient::set_family(
self : SocketClient,
family : SocketFamily,
) = "moonbit_g_socket_client_set_family"
///|
#borrow(self_, address)
extern "c" fn moonbit_g_socket_client_set_local_address(
self_ : SocketClient,
address : @glib.Nullable[SocketAddress],
) = "moonbit_g_socket_client_set_local_address"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.set_local_address.html).
pub fn SocketClient::set_local_address(
self : SocketClient,
address : &ISocketAddress?,
) -> Unit {
moonbit_g_socket_client_set_local_address(
self,
match address {
Some(v) => @glib.Nullable::some(v.as_socket_address())
None => @glib.Nullable::null()
},
)
}
///|
#borrow(self_, proxy_resolver)
extern "c" fn moonbit_g_socket_client_set_proxy_resolver(
self_ : SocketClient,
proxy_resolver : @glib.Nullable[ProxyResolver],
) = "moonbit_g_socket_client_set_proxy_resolver"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.set_proxy_resolver.html).
pub fn SocketClient::set_proxy_resolver(
self : SocketClient,
proxy_resolver : &IProxyResolver?,
) -> Unit {
moonbit_g_socket_client_set_proxy_resolver(
self,
match proxy_resolver {
Some(v) => @glib.Nullable::some(v.as_proxy_resolver())
None => @glib.Nullable::null()
},
)
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.set_socket_type.html).
#borrow(self)
pub extern "c" fn SocketClient::set_socket_type(
self : SocketClient,
type_ : SocketType,
) = "moonbit_g_socket_client_set_socket_type"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.set_timeout.html).
#borrow(self)
pub extern "c" fn SocketClient::set_timeout(
self : SocketClient,
timeout : UInt,
) = "moonbit_g_socket_client_set_timeout"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.set_tls.html).
#borrow(self)
pub extern "c" fn SocketClient::set_tls(self : SocketClient, tls : Bool) = "moonbit_g_socket_client_set_tls"
///|
#borrow(instance)
extern "c" fn g_socket_client_connect_event(
instance : SocketClient,
function : FuncRef[
(
SocketClient,
SocketClientEvent,
SocketConnectable,
IOStream?,
(SocketClient, SocketClientEvent, SocketConnectable, IOStream?) -> Unit,
) -> Unit,
],
closure : (SocketClient, SocketClientEvent, SocketConnectable, IOStream?) -> Unit,
) -> UInt64 = "moonbit_g_socket_client_connect_event"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.SocketClient.event.html).
pub fn SocketClient::connect_event(
self : SocketClient,
f : (SocketClient, SocketClientEvent, SocketConnectable, IOStream?) -> Unit,
) -> UInt64 {
g_socket_client_connect_event(
self,
fn(instance_, event, connectable, connection, f) {
f(instance_, event, connectable, connection)
},
f,
)
}
///|
#borrow(self_, connectable, cancellable)
extern "c" fn g_socket_client_connect_async(
self_ : SocketClient,
connectable : SocketConnectable,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
@glib.Nullable[SocketConnection],
@glib.Nullable[@glib.Error_],
(@glib.Nullable[SocketConnection], @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (@glib.Nullable[SocketConnection], @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_socket_client_connect_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.connect_async.html).
pub fn SocketClient::connect_async(
self : SocketClient,
connectable : &ISocketConnectable,
cancellable : &ICancellable?,
callback : (Result[SocketConnection, @glib.Error_]) -> Unit,
) -> Unit {
g_socket_client_connect_async(
self,
connectable.as_socket_connectable(),
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None =>
match result.to_option() {
Some(v) => callback(Ok(v))
None => ()
}
}
},
)
}
///|
#borrow(self_, host_and_port, cancellable)
extern "c" fn g_socket_client_connect_to_host_async(
self_ : SocketClient,
host_and_port : Bytes,
default_port : UInt,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
@glib.Nullable[SocketConnection],
@glib.Nullable[@glib.Error_],
(@glib.Nullable[SocketConnection], @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (@glib.Nullable[SocketConnection], @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_socket_client_connect_to_host_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.connect_to_host_async.html).
pub fn SocketClient::connect_to_host_async(
self : SocketClient,
host_and_port : String,
default_port : UInt,
cancellable : &ICancellable?,
callback : (Result[SocketConnection, @glib.Error_]) -> Unit,
) -> Unit {
g_socket_client_connect_to_host_async(
self,
@encoding/utf8.encode(host_and_port),
default_port,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None =>
match result.to_option() {
Some(v) => callback(Ok(v))
None => ()
}
}
},
)
}
///|
#borrow(self_, domain, service, cancellable)
extern "c" fn g_socket_client_connect_to_service_async(
self_ : SocketClient,
domain : Bytes,
service : Bytes,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
@glib.Nullable[SocketConnection],
@glib.Nullable[@glib.Error_],
(@glib.Nullable[SocketConnection], @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (@glib.Nullable[SocketConnection], @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_socket_client_connect_to_service_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.connect_to_service_async.html).
pub fn SocketClient::connect_to_service_async(
self : SocketClient,
domain : String,
service : String,
cancellable : &ICancellable?,
callback : (Result[SocketConnection, @glib.Error_]) -> Unit,
) -> Unit {
g_socket_client_connect_to_service_async(
self,
@encoding/utf8.encode(domain),
@encoding/utf8.encode(service),
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None =>
match result.to_option() {
Some(v) => callback(Ok(v))
None => ()
}
}
},
)
}
///|
#borrow(self_, uri, cancellable)
extern "c" fn g_socket_client_connect_to_uri_async(
self_ : SocketClient,
uri : Bytes,
default_port : UInt,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
@glib.Nullable[SocketConnection],
@glib.Nullable[@glib.Error_],
(@glib.Nullable[SocketConnection], @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (@glib.Nullable[SocketConnection], @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_socket_client_connect_to_uri_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.SocketClient.connect_to_uri_async.html).
pub fn SocketClient::connect_to_uri_async(
self : SocketClient,
uri : String,
default_port : UInt,
cancellable : &ICancellable?,
callback : (Result[SocketConnection, @glib.Error_]) -> Unit,
) -> Unit {
g_socket_client_connect_to_uri_async(
self,
@encoding/utf8.encode(uri),
default_port,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None =>
match result.to_option() {
Some(v) => callback(Ok(v))
None => ()
}
}
},
)
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/property.SocketClient.type.html).
#borrow(self_)
pub extern "c" fn SocketClient::get_type(self_ : SocketClient) -> SocketType = "moonbit_g_socket_client_get_type"
///|
#borrow(self_)
pub extern "c" fn SocketClient::set_type(
self_ : SocketClient,
value : SocketType,
) = "moonbit_g_socket_client_set_type"
///|
impl ISocketClient with fn add_application_proxy(self, protocol) -> Unit {
self.as_socket_client().add_application_proxy(protocol)
}
///|
impl ISocketClient with fn connect(self, connectable, cancellable) -> SocketConnection raise @glib.Error_ {
self.as_socket_client().connect(connectable, cancellable)
}
///|
impl ISocketClient with fn connect_to_host(
self,
host_and_port,
default_port,
cancellable,
) -> SocketConnection raise @glib.Error_ {
self
.as_socket_client()
.connect_to_host(host_and_port, default_port, cancellable)
}
///|
impl ISocketClient with fn connect_to_service(
self,
domain,
service,
cancellable,
) -> SocketConnection raise @glib.Error_ {
self.as_socket_client().connect_to_service(domain, service, cancellable)
}
///|
impl ISocketClient with fn connect_to_uri(self, uri, default_port, cancellable) -> SocketConnection raise @glib.Error_ {
self.as_socket_client().connect_to_uri(uri, default_port, cancellable)
}
///|
impl ISocketClient with fn get_enable_proxy(self) -> Bool {
self.as_socket_client().get_enable_proxy()
}
///|
impl ISocketClient with fn get_family(self) -> SocketFamily {
self.as_socket_client().get_family()
}
///|
impl ISocketClient with fn get_local_address(self) -> SocketAddress? {
self.as_socket_client().get_local_address()
}
///|
impl ISocketClient with fn get_proxy_resolver(self) -> ProxyResolver {
self.as_socket_client().get_proxy_resolver()
}
///|
impl ISocketClient with fn get_socket_type(self) -> SocketType {
self.as_socket_client().get_socket_type()
}
///|
impl ISocketClient with fn get_timeout(self) -> UInt {
self.as_socket_client().get_timeout()
}
///|
impl ISocketClient with fn get_tls(self) -> Bool {
self.as_socket_client().get_tls()
}
///|
impl ISocketClient with fn set_enable_proxy(self, enable) -> Unit {
self.as_socket_client().set_enable_proxy(enable)
}
///|
impl ISocketClient with fn set_family(self, family) -> Unit {
self.as_socket_client().set_family(family)
}
///|
impl ISocketClient with fn set_local_address(self, address) -> Unit {
self.as_socket_client().set_local_address(address)
}
///|
impl ISocketClient with fn set_proxy_resolver(self, proxy_resolver) -> Unit {
self.as_socket_client().set_proxy_resolver(proxy_resolver)
}
///|
impl ISocketClient with fn set_socket_type(self, type_) -> Unit {
self.as_socket_client().set_socket_type(type_)
}
///|
impl ISocketClient with fn set_timeout(self, timeout) -> Unit {
self.as_socket_client().set_timeout(timeout)
}
///|
impl ISocketClient with fn set_tls(self, tls) -> Unit {
self.as_socket_client().set_tls(tls)
}
///|
impl ISocketClient with fn connect_event(self, f) -> UInt64 {
self.as_socket_client().connect_event(f)
}
///|
impl ISocketClient with fn connect_async(
self,
connectable,
cancellable,
callback,
) -> Unit {
self.as_socket_client().connect_async(connectable, cancellable, callback)
}
///|
impl ISocketClient with fn connect_to_host_async(
self,
host_and_port,
default_port,
cancellable,
callback,
) -> Unit {
self
.as_socket_client()
.connect_to_host_async(host_and_port, default_port, cancellable, callback)
}
///|
impl ISocketClient with fn connect_to_service_async(
self,
domain,
service,
cancellable,
callback,
) -> Unit {
self
.as_socket_client()
.connect_to_service_async(domain, service, cancellable, callback)
}
///|
impl ISocketClient with fn connect_to_uri_async(
self,
uri,
default_port,
cancellable,
callback,
) -> Unit {
self
.as_socket_client()
.connect_to_uri_async(uri, default_port, cancellable, callback)
}
///|
pub fn SocketClient::as_gobject_object(self : SocketClient) -> @gobject.Object = "%identity"
///|
pub impl @gobject.IObject for SocketClient with fn as_object(self) {
self.as_gobject_object()
}