gio/auto/
srv_target.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use gio_sys;
6use glib::translate::*;
7use glib::GString;
8
9glib_wrapper! {
10    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11    pub struct SrvTarget(Boxed<gio_sys::GSrvTarget>);
12
13    match fn {
14        copy => |ptr| gio_sys::g_srv_target_copy(mut_override(ptr)),
15        free => |ptr| gio_sys::g_srv_target_free(ptr),
16        get_type => || gio_sys::g_srv_target_get_type(),
17    }
18}
19
20impl SrvTarget {
21    pub fn new(hostname: &str, port: u16, priority: u16, weight: u16) -> SrvTarget {
22        unsafe {
23            from_glib_full(gio_sys::g_srv_target_new(
24                hostname.to_glib_none().0,
25                port,
26                priority,
27                weight,
28            ))
29        }
30    }
31
32    pub fn get_hostname(&mut self) -> Option<GString> {
33        unsafe {
34            from_glib_none(gio_sys::g_srv_target_get_hostname(
35                self.to_glib_none_mut().0,
36            ))
37        }
38    }
39
40    pub fn get_port(&mut self) -> u16 {
41        unsafe { gio_sys::g_srv_target_get_port(self.to_glib_none_mut().0) }
42    }
43
44    pub fn get_priority(&mut self) -> u16 {
45        unsafe { gio_sys::g_srv_target_get_priority(self.to_glib_none_mut().0) }
46    }
47
48    pub fn get_weight(&mut self) -> u16 {
49        unsafe { gio_sys::g_srv_target_get_weight(self.to_glib_none_mut().0) }
50    }
51
52    //pub fn list_sort(targets: /*Unimplemented*/&[&Fundamental: Pointer]) -> /*Unimplemented*/Vec<Fundamental: Pointer> {
53    //    unsafe { TODO: call gio_sys:g_srv_target_list_sort() }
54    //}
55}