pub struct Cookie<'a, C, R>where
C: RequestConnection + ?Sized,{ /* private fields */ }
Expand description
A handle to a response from the X11 server.
When sending a request to the X11 server, this library returns a Cookie
. This Cookie
can
then later be used to get the response that the server sent.
See crate::cookie for infos on the different ways to handle X11 errors in response to a request.
Implementations§
Source§impl<C, R> Cookie<'_, C, R>
impl<C, R> Cookie<'_, C, R>
Sourcepub fn new(connection: &C, sequence_number: SequenceNumber) -> Cookie<'_, C, R>
pub fn new(connection: &C, sequence_number: SequenceNumber) -> Cookie<'_, C, R>
Construct a new cookie.
This function should only be used by implementations of
RequestConnection::send_request_with_reply
.
Sourcepub fn sequence_number(&self) -> SequenceNumber
pub fn sequence_number(&self) -> SequenceNumber
Get the sequence number of the request that generated this cookie.
Sourcepub fn raw_reply(self) -> Result<C::Buf, ReplyError>
pub fn raw_reply(self) -> Result<C::Buf, ReplyError>
Get the raw reply that the server sent.
Sourcepub fn raw_reply_unchecked(self) -> Result<Option<C::Buf>, ConnectionError>
pub fn raw_reply_unchecked(self) -> Result<Option<C::Buf>, ConnectionError>
Get the raw reply that the server sent, but have errors handled as events.
Sourcepub fn reply(self) -> Result<R, ReplyError>
pub fn reply(self) -> Result<R, ReplyError>
Get the reply that the server sent.
Sourcepub fn reply_unchecked(self) -> Result<Option<R>, ConnectionError>
pub fn reply_unchecked(self) -> Result<Option<R>, ConnectionError>
Get the reply that the server sent, but have errors handled as events.
Sourcepub fn discard_reply_and_errors(self)
pub fn discard_reply_and_errors(self)
Discard all responses to the request this cookie represents, even errors.
Without this function, errors are treated as events after the cookie is dropped.