pub struct SegWrapper<C: RequestConnection>(/* private fields */);
Expand description
A RAII-like wrapper around a Seg.
Instances of this struct represent a Seg 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> SegWrapper<C>
impl<C: RequestConnection> SegWrapper<C>
source§impl<'c, C: X11Connection> SegWrapper<&'c C>
impl<'c, C: X11Connection> SegWrapper<&'c C>
Create a new Seg and return a Seg wrapper and a cookie.
This is a thin wrapper around attach that allocates an id for the Seg.
This function returns the resulting SegWrapper
that owns the created Seg and frees
it in Drop
. This also returns a VoidCookie
that comes from the call to
attach.
Errors can come from the call to X11Connection::generate_id or attach.
source§impl<C: X11Connection> SegWrapper<C>
impl<C: X11Connection> SegWrapper<C>
sourcepub fn attach(
conn: C,
shmid: u32,
read_only: bool,
) -> Result<Self, ReplyOrIdError>
pub fn attach( conn: C, shmid: u32, read_only: bool, ) -> Result<Self, ReplyOrIdError>
Create a new Seg and return a Seg wrapper
This is a thin wrapper around attach that allocates an id for the Seg.
This function returns the resulting SegWrapper
that owns the created Seg and frees
it in Drop
.
Errors can come from the call to X11Connection::generate_id or attach.
source§impl<'c, C: X11Connection> SegWrapper<&'c C>
impl<'c, C: X11Connection> SegWrapper<&'c C>
Create a new Seg and return a Seg wrapper and a cookie.
This is a thin wrapper around attach_fd that allocates an id for the Seg.
This function returns the resulting SegWrapper
that owns the created Seg and frees
it in Drop
. This also returns a VoidCookie
that comes from the call to
attach_fd.
Errors can come from the call to X11Connection::generate_id or attach_fd.
source§impl<C: X11Connection> SegWrapper<C>
impl<C: X11Connection> SegWrapper<C>
sourcepub fn attach_fd<A>(
conn: C,
shm_fd: A,
read_only: bool,
) -> Result<Self, ReplyOrIdError>where
A: Into<RawFdContainer>,
pub fn attach_fd<A>(
conn: C,
shm_fd: A,
read_only: bool,
) -> Result<Self, ReplyOrIdError>where
A: Into<RawFdContainer>,
Create a new Seg and return a Seg wrapper
This is a thin wrapper around attach_fd that allocates an id for the Seg.
This function returns the resulting SegWrapper
that owns the created Seg and frees
it in Drop
.
Errors can come from the call to X11Connection::generate_id or attach_fd.