pub struct ColormapWrapper<C: RequestConnection>(/* private fields */);
Expand description
A RAII-like wrapper around a Colormap.
Instances of this struct represent a Colormap 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> ColormapWrapper<C>
impl<C: RequestConnection> ColormapWrapper<C>
Sourcepub fn for_colormap(conn: C, id: Colormap) -> Self
pub fn for_colormap(conn: C, id: Colormap) -> Self
Assume ownership of the given resource and destroy it in Drop
.
Sourcepub fn into_colormap(self) -> Colormap
pub fn into_colormap(self) -> Colormap
Assume ownership of the XID of the wrapped resource
This function destroys this wrapper without freeing the underlying resource.
Source§impl<'c, C: X11Connection> ColormapWrapper<&'c C>
impl<'c, C: X11Connection> ColormapWrapper<&'c C>
Create a new Colormap and return a Colormap wrapper and a cookie.
This is a thin wrapper around create_colormap that allocates an id for the Colormap.
This function returns the resulting ColormapWrapper
that owns the created Colormap and frees
it in Drop
. This also returns a VoidCookie
that comes from the call to
create_colormap.
Errors can come from the call to X11Connection::generate_id or create_colormap.
Source§impl<C: X11Connection> ColormapWrapper<C>
impl<C: X11Connection> ColormapWrapper<C>
Sourcepub fn create_colormap(
conn: C,
alloc: ColormapAlloc,
window: Window,
visual: Visualid,
) -> Result<Self, ReplyOrIdError>
pub fn create_colormap( conn: C, alloc: ColormapAlloc, window: Window, visual: Visualid, ) -> Result<Self, ReplyOrIdError>
Create a new Colormap and return a Colormap wrapper
This is a thin wrapper around create_colormap that allocates an id for the Colormap.
This function returns the resulting ColormapWrapper
that owns the created Colormap and frees
it in Drop
.
Errors can come from the call to X11Connection::generate_id or create_colormap.