1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// This code was autogenerated with `dbus-codegen-rust -s -m None`, see https://github.com/diwic/dbus-rs
use dbus as dbus;
#[allow(unused_imports)]
use dbus::arg;
use dbus::blocking;

pub trait OrgChromiumSpaced {
    fn get_free_disk_space(&self, path: &str) -> Result<i64, dbus::Error>;
    fn get_total_disk_space(&self, path: &str) -> Result<i64, dbus::Error>;
    fn get_root_device_size(&self) -> Result<i64, dbus::Error>;
    fn is_quota_supported(&self, path: &str) -> Result<bool, dbus::Error>;
    fn get_quota_current_space_for_uid(&self, path: &str, uid: u32) -> Result<i64, dbus::Error>;
    fn get_quota_current_space_for_gid(&self, path: &str, gid: u32) -> Result<i64, dbus::Error>;
    fn get_quota_current_space_for_project_id(&self, path: &str, project_id: u32) -> Result<i64, dbus::Error>;
    fn get_quota_current_spaces_for_ids(&self, request: Vec<u8>) -> Result<Vec<u8>, dbus::Error>;
    fn get_quota_overall_usage(&self, path: &str) -> Result<Vec<u8>, dbus::Error>;
    fn get_quota_overall_usage_pretty_print(&self, path: &str) -> Result<String, dbus::Error>;
    fn set_project_id(&self, fd: arg::OwnedFd, project_id: u32) -> Result<Vec<u8>, dbus::Error>;
    fn set_project_inheritance_flag(&self, fd: arg::OwnedFd, enable: bool) -> Result<Vec<u8>, dbus::Error>;
}

#[derive(Debug)]
pub struct OrgChromiumSpacedStatefulDiskSpaceUpdate {
    pub status: Vec<u8>,
}

impl arg::AppendAll for OrgChromiumSpacedStatefulDiskSpaceUpdate {
    fn append(&self, i: &mut arg::IterAppend) {
        arg::RefArg::append(&self.status, i);
    }
}

impl arg::ReadAll for OrgChromiumSpacedStatefulDiskSpaceUpdate {
    fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
        Ok(OrgChromiumSpacedStatefulDiskSpaceUpdate {
            status: i.read()?,
        })
    }
}

impl dbus::message::SignalArgs for OrgChromiumSpacedStatefulDiskSpaceUpdate {
    const NAME: &'static str = "StatefulDiskSpaceUpdate";
    const INTERFACE: &'static str = "org.chromium.Spaced";
}

impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgChromiumSpaced for blocking::Proxy<'a, C> {

    fn get_free_disk_space(&self, path: &str) -> Result<i64, dbus::Error> {
        self.method_call("org.chromium.Spaced", "GetFreeDiskSpace", (path, ))
            .and_then(|r: (i64, )| Ok(r.0, ))
    }

    fn get_total_disk_space(&self, path: &str) -> Result<i64, dbus::Error> {
        self.method_call("org.chromium.Spaced", "GetTotalDiskSpace", (path, ))
            .and_then(|r: (i64, )| Ok(r.0, ))
    }

    fn get_root_device_size(&self) -> Result<i64, dbus::Error> {
        self.method_call("org.chromium.Spaced", "GetRootDeviceSize", ())
            .and_then(|r: (i64, )| Ok(r.0, ))
    }

    fn is_quota_supported(&self, path: &str) -> Result<bool, dbus::Error> {
        self.method_call("org.chromium.Spaced", "IsQuotaSupported", (path, ))
            .and_then(|r: (bool, )| Ok(r.0, ))
    }

    fn get_quota_current_space_for_uid(&self, path: &str, uid: u32) -> Result<i64, dbus::Error> {
        self.method_call("org.chromium.Spaced", "GetQuotaCurrentSpaceForUid", (path, uid, ))
            .and_then(|r: (i64, )| Ok(r.0, ))
    }

    fn get_quota_current_space_for_gid(&self, path: &str, gid: u32) -> Result<i64, dbus::Error> {
        self.method_call("org.chromium.Spaced", "GetQuotaCurrentSpaceForGid", (path, gid, ))
            .and_then(|r: (i64, )| Ok(r.0, ))
    }

    fn get_quota_current_space_for_project_id(&self, path: &str, project_id: u32) -> Result<i64, dbus::Error> {
        self.method_call("org.chromium.Spaced", "GetQuotaCurrentSpaceForProjectId", (path, project_id, ))
            .and_then(|r: (i64, )| Ok(r.0, ))
    }

    fn get_quota_current_spaces_for_ids(&self, request: Vec<u8>) -> Result<Vec<u8>, dbus::Error> {
        self.method_call("org.chromium.Spaced", "GetQuotaCurrentSpacesForIds", (request, ))
            .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
    }

    fn get_quota_overall_usage(&self, path: &str) -> Result<Vec<u8>, dbus::Error> {
        self.method_call("org.chromium.Spaced", "GetQuotaOverallUsage", (path, ))
            .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
    }

    fn get_quota_overall_usage_pretty_print(&self, path: &str) -> Result<String, dbus::Error> {
        self.method_call("org.chromium.Spaced", "GetQuotaOverallUsagePrettyPrint", (path, ))
            .and_then(|r: (String, )| Ok(r.0, ))
    }

    fn set_project_id(&self, fd: arg::OwnedFd, project_id: u32) -> Result<Vec<u8>, dbus::Error> {
        self.method_call("org.chromium.Spaced", "SetProjectId", (fd, project_id, ))
            .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
    }

    fn set_project_inheritance_flag(&self, fd: arg::OwnedFd, enable: bool) -> Result<Vec<u8>, dbus::Error> {
        self.method_call("org.chromium.Spaced", "SetProjectInheritanceFlag", (fd, enable, ))
            .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
    }
}