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
// MIT/Apache2 License

use crate::{
    auto::xproto::{FreePixmapRequest, Pixmap},
    display::{Connection, Display},
    sr_request,
};

#[cfg(feature = "async")]
use crate::display::AsyncConnection;

impl Pixmap {
    /// Free the memory used by a pixmap.
    #[inline]
    pub fn free<Conn: Connection>(self, dpy: &mut Display<Conn>) -> crate::Result {
        sr_request!(
            dpy,
            FreePixmapRequest {
                pixmap: self,
                ..Default::default()
            }
        )
    }

    /// Free the memory used by a pixmap, async redox.
    #[cfg(feature = "async")]
    #[inline]
    pub async fn free_async<Conn: AsyncConnection + Send>(
        self,
        dpy: &mut Display<Conn>,
    ) -> crate::Result {
        sr_request!(
            dpy,
            FreePixmapRequest {
                pixmap: self,
                ..Default::default()
            },
            async
        )
        .await
    }
}