Struct x11rb::protocol::xproto::GcontextWrapper
source · pub struct GcontextWrapper<C: RequestConnection>(/* private fields */);
Expand description
A RAII-like wrapper around a Gcontext.
Instances of this struct represent a Gcontext 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> GcontextWrapper<C>
impl<C: RequestConnection> GcontextWrapper<C>
sourcepub fn for_gcontext(conn: C, id: Gcontext) -> Self
pub fn for_gcontext(conn: C, id: Gcontext) -> Self
Assume ownership of the given resource and destroy it in Drop
.
sourcepub fn into_gcontext(self) -> Gcontext
pub fn into_gcontext(self) -> Gcontext
Assume ownership of the XID of the wrapped resource
This function destroys this wrapper without freeing the underlying resource.
source§impl<'c, C: X11Connection> GcontextWrapper<&'c C>
impl<'c, C: X11Connection> GcontextWrapper<&'c C>
Create a new Gcontext and return a Gcontext wrapper and a cookie.
This is a thin wrapper around create_gc that allocates an id for the Gcontext.
This function returns the resulting GcontextWrapper
that owns the created Gcontext and frees
it in Drop
. This also returns a VoidCookie
that comes from the call to
create_gc.
Errors can come from the call to X11Connection::generate_id or create_gc.
source§impl<C: X11Connection> GcontextWrapper<C>
impl<C: X11Connection> GcontextWrapper<C>
sourcepub fn create_gc(
conn: C,
drawable: Drawable,
value_list: &CreateGCAux
) -> Result<Self, ReplyOrIdError>
pub fn create_gc( conn: C, drawable: Drawable, value_list: &CreateGCAux ) -> Result<Self, ReplyOrIdError>
Create a new Gcontext and return a Gcontext wrapper
This is a thin wrapper around create_gc that allocates an id for the Gcontext.
This function returns the resulting GcontextWrapper
that owns the created Gcontext and frees
it in Drop
.
Errors can come from the call to X11Connection::generate_id or create_gc.