Struct x11rb::protocol::xproto::PixmapWrapper
source · pub struct PixmapWrapper<C: RequestConnection>(/* private fields */);
Expand description
A RAII-like wrapper around a Pixmap.
Instances of this struct represent a Pixmap that is freed in Drop
.
Any errors during Drop
are silently ignored. Most likely an error here means that your
X11 connection is broken and later requests will also fail.
Implementations§
source§impl<C: RequestConnection> PixmapWrapper<C>
impl<C: RequestConnection> PixmapWrapper<C>
sourcepub fn for_pixmap(conn: C, id: Pixmap) -> Self
pub fn for_pixmap(conn: C, id: Pixmap) -> Self
Assume ownership of the given resource and destroy it in Drop
.
sourcepub fn into_pixmap(self) -> Pixmap
pub fn into_pixmap(self) -> Pixmap
Assume ownership of the XID of the wrapped resource
This function destroys this wrapper without freeing the underlying resource.
source§impl<'c, C: X11Connection> PixmapWrapper<&'c C>
impl<'c, C: X11Connection> PixmapWrapper<&'c C>
Create a new Pixmap and return a Pixmap wrapper and a cookie.
This is a thin wrapper around create_pixmap that allocates an id for the Pixmap.
This function returns the resulting PixmapWrapper
that owns the created Pixmap and frees
it in Drop
. This also returns a VoidCookie
that comes from the call to
create_pixmap.
Errors can come from the call to X11Connection::generate_id or create_pixmap.
source§impl<C: X11Connection> PixmapWrapper<C>
impl<C: X11Connection> PixmapWrapper<C>
sourcepub fn create_pixmap(
conn: C,
depth: u8,
drawable: Drawable,
width: u16,
height: u16
) -> Result<Self, ReplyOrIdError>
pub fn create_pixmap( conn: C, depth: u8, drawable: Drawable, width: u16, height: u16 ) -> Result<Self, ReplyOrIdError>
Create a new Pixmap and return a Pixmap wrapper
This is a thin wrapper around create_pixmap that allocates an id for the Pixmap.
This function returns the resulting PixmapWrapper
that owns the created Pixmap and frees
it in Drop
.
Errors can come from the call to X11Connection::generate_id or create_pixmap.