x11rb_async/protocol/
xprint.rs

1// This file contains generated code. Do not edit directly.
2// To regenerate this, run 'make'.
3
4//! Bindings to the `XPrint` X11 extension.
5
6#![allow(clippy::too_many_arguments)]
7
8#[allow(unused_imports)]
9use std::borrow::Cow;
10#[allow(unused_imports)]
11use std::convert::TryInto;
12#[allow(unused_imports)]
13use crate::utils::RawFdContainer;
14#[allow(unused_imports)]
15use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
16use std::io::IoSlice;
17use crate::connection::RequestConnection;
18#[allow(unused_imports)]
19use crate::connection::Connection as X11Connection;
20#[allow(unused_imports)]
21use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
22use crate::errors::ConnectionError;
23#[allow(unused_imports)]
24use crate::errors::ReplyOrIdError;
25use std::future::Future;
26use std::pin::Pin;
27#[allow(unused_imports)]
28use super::xproto;
29
30pub use x11rb_protocol::protocol::xprint::*;
31
32/// Get the major opcode of this extension
33async fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
34    let info = conn.extension_information(X11_EXTENSION_NAME).await?;
35    let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
36    Ok(info.major_opcode)
37}
38
39pub async fn print_query_version<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, PrintQueryVersionReply>, ConnectionError>
40where
41    Conn: RequestConnection + ?Sized,
42{
43    let request0 = PrintQueryVersionRequest;
44    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
45    let slices = [IoSlice::new(&bytes[0])];
46    assert_eq!(slices.len(), bytes.len());
47    conn.send_request_with_reply(&slices, fds).await
48}
49pub async fn print_get_printer_list<'c, 'input, Conn>(conn: &'c Conn, printer_name: &'input [String8], locale: &'input [String8]) -> Result<Cookie<'c, Conn, PrintGetPrinterListReply>, ConnectionError>
50where
51    Conn: RequestConnection + ?Sized,
52{
53    let request0 = PrintGetPrinterListRequest {
54        printer_name: Cow::Borrowed(printer_name),
55        locale: Cow::Borrowed(locale),
56    };
57    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
58    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
59    assert_eq!(slices.len(), bytes.len());
60    conn.send_request_with_reply(&slices, fds).await
61}
62pub async fn print_rehash_printer_list<Conn>(conn: &Conn) -> Result<VoidCookie<'_, Conn>, ConnectionError>
63where
64    Conn: RequestConnection + ?Sized,
65{
66    let request0 = PrintRehashPrinterListRequest;
67    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
68    let slices = [IoSlice::new(&bytes[0])];
69    assert_eq!(slices.len(), bytes.len());
70    conn.send_request_without_reply(&slices, fds).await
71}
72pub async fn create_context<'c, 'input, Conn>(conn: &'c Conn, context_id: u32, printer_name: &'input [String8], locale: &'input [String8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
73where
74    Conn: RequestConnection + ?Sized,
75{
76    let request0 = CreateContextRequest {
77        context_id,
78        printer_name: Cow::Borrowed(printer_name),
79        locale: Cow::Borrowed(locale),
80    };
81    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
82    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
83    assert_eq!(slices.len(), bytes.len());
84    conn.send_request_without_reply(&slices, fds).await
85}
86pub async fn print_set_context<Conn>(conn: &Conn, context: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
87where
88    Conn: RequestConnection + ?Sized,
89{
90    let request0 = PrintSetContextRequest {
91        context,
92    };
93    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
94    let slices = [IoSlice::new(&bytes[0])];
95    assert_eq!(slices.len(), bytes.len());
96    conn.send_request_without_reply(&slices, fds).await
97}
98pub async fn print_get_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, PrintGetContextReply>, ConnectionError>
99where
100    Conn: RequestConnection + ?Sized,
101{
102    let request0 = PrintGetContextRequest;
103    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
104    let slices = [IoSlice::new(&bytes[0])];
105    assert_eq!(slices.len(), bytes.len());
106    conn.send_request_with_reply(&slices, fds).await
107}
108pub async fn print_destroy_context<Conn>(conn: &Conn, context: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
109where
110    Conn: RequestConnection + ?Sized,
111{
112    let request0 = PrintDestroyContextRequest {
113        context,
114    };
115    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
116    let slices = [IoSlice::new(&bytes[0])];
117    assert_eq!(slices.len(), bytes.len());
118    conn.send_request_without_reply(&slices, fds).await
119}
120pub async fn print_get_screen_of_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, PrintGetScreenOfContextReply>, ConnectionError>
121where
122    Conn: RequestConnection + ?Sized,
123{
124    let request0 = PrintGetScreenOfContextRequest;
125    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
126    let slices = [IoSlice::new(&bytes[0])];
127    assert_eq!(slices.len(), bytes.len());
128    conn.send_request_with_reply(&slices, fds).await
129}
130pub async fn print_start_job<Conn>(conn: &Conn, output_mode: u8) -> Result<VoidCookie<'_, Conn>, ConnectionError>
131where
132    Conn: RequestConnection + ?Sized,
133{
134    let request0 = PrintStartJobRequest {
135        output_mode,
136    };
137    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
138    let slices = [IoSlice::new(&bytes[0])];
139    assert_eq!(slices.len(), bytes.len());
140    conn.send_request_without_reply(&slices, fds).await
141}
142pub async fn print_end_job<Conn>(conn: &Conn, cancel: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
143where
144    Conn: RequestConnection + ?Sized,
145{
146    let request0 = PrintEndJobRequest {
147        cancel,
148    };
149    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
150    let slices = [IoSlice::new(&bytes[0])];
151    assert_eq!(slices.len(), bytes.len());
152    conn.send_request_without_reply(&slices, fds).await
153}
154pub async fn print_start_doc<Conn>(conn: &Conn, driver_mode: u8) -> Result<VoidCookie<'_, Conn>, ConnectionError>
155where
156    Conn: RequestConnection + ?Sized,
157{
158    let request0 = PrintStartDocRequest {
159        driver_mode,
160    };
161    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
162    let slices = [IoSlice::new(&bytes[0])];
163    assert_eq!(slices.len(), bytes.len());
164    conn.send_request_without_reply(&slices, fds).await
165}
166pub async fn print_end_doc<Conn>(conn: &Conn, cancel: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
167where
168    Conn: RequestConnection + ?Sized,
169{
170    let request0 = PrintEndDocRequest {
171        cancel,
172    };
173    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
174    let slices = [IoSlice::new(&bytes[0])];
175    assert_eq!(slices.len(), bytes.len());
176    conn.send_request_without_reply(&slices, fds).await
177}
178pub async fn print_put_document_data<'c, 'input, Conn>(conn: &'c Conn, drawable: xproto::Drawable, data: &'input [u8], doc_format: &'input [String8], options: &'input [String8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
179where
180    Conn: RequestConnection + ?Sized,
181{
182    let request0 = PrintPutDocumentDataRequest {
183        drawable,
184        data: Cow::Borrowed(data),
185        doc_format: Cow::Borrowed(doc_format),
186        options: Cow::Borrowed(options),
187    };
188    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
189    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4]), IoSlice::new(&bytes[5]), IoSlice::new(&bytes[6])];
190    assert_eq!(slices.len(), bytes.len());
191    conn.send_request_without_reply(&slices, fds).await
192}
193pub async fn print_get_document_data<Conn>(conn: &Conn, context: Pcontext, max_bytes: u32) -> Result<Cookie<'_, Conn, PrintGetDocumentDataReply>, ConnectionError>
194where
195    Conn: RequestConnection + ?Sized,
196{
197    let request0 = PrintGetDocumentDataRequest {
198        context,
199        max_bytes,
200    };
201    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
202    let slices = [IoSlice::new(&bytes[0])];
203    assert_eq!(slices.len(), bytes.len());
204    conn.send_request_with_reply(&slices, fds).await
205}
206pub async fn print_start_page<Conn>(conn: &Conn, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
207where
208    Conn: RequestConnection + ?Sized,
209{
210    let request0 = PrintStartPageRequest {
211        window,
212    };
213    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
214    let slices = [IoSlice::new(&bytes[0])];
215    assert_eq!(slices.len(), bytes.len());
216    conn.send_request_without_reply(&slices, fds).await
217}
218pub async fn print_end_page<Conn>(conn: &Conn, cancel: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
219where
220    Conn: RequestConnection + ?Sized,
221{
222    let request0 = PrintEndPageRequest {
223        cancel,
224    };
225    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
226    let slices = [IoSlice::new(&bytes[0])];
227    assert_eq!(slices.len(), bytes.len());
228    conn.send_request_without_reply(&slices, fds).await
229}
230pub async fn print_select_input<Conn>(conn: &Conn, context: Pcontext, event_mask: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
231where
232    Conn: RequestConnection + ?Sized,
233{
234    let request0 = PrintSelectInputRequest {
235        context,
236        event_mask,
237    };
238    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
239    let slices = [IoSlice::new(&bytes[0])];
240    assert_eq!(slices.len(), bytes.len());
241    conn.send_request_without_reply(&slices, fds).await
242}
243pub async fn print_input_selected<Conn>(conn: &Conn, context: Pcontext) -> Result<Cookie<'_, Conn, PrintInputSelectedReply>, ConnectionError>
244where
245    Conn: RequestConnection + ?Sized,
246{
247    let request0 = PrintInputSelectedRequest {
248        context,
249    };
250    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
251    let slices = [IoSlice::new(&bytes[0])];
252    assert_eq!(slices.len(), bytes.len());
253    conn.send_request_with_reply(&slices, fds).await
254}
255pub async fn print_get_attributes<Conn>(conn: &Conn, context: Pcontext, pool: u8) -> Result<Cookie<'_, Conn, PrintGetAttributesReply>, ConnectionError>
256where
257    Conn: RequestConnection + ?Sized,
258{
259    let request0 = PrintGetAttributesRequest {
260        context,
261        pool,
262    };
263    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
264    let slices = [IoSlice::new(&bytes[0])];
265    assert_eq!(slices.len(), bytes.len());
266    conn.send_request_with_reply(&slices, fds).await
267}
268pub async fn print_get_one_attributes<'c, 'input, Conn>(conn: &'c Conn, context: Pcontext, pool: u8, name: &'input [String8]) -> Result<Cookie<'c, Conn, PrintGetOneAttributesReply>, ConnectionError>
269where
270    Conn: RequestConnection + ?Sized,
271{
272    let request0 = PrintGetOneAttributesRequest {
273        context,
274        pool,
275        name: Cow::Borrowed(name),
276    };
277    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
278    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
279    assert_eq!(slices.len(), bytes.len());
280    conn.send_request_with_reply(&slices, fds).await
281}
282pub async fn print_set_attributes<'c, 'input, Conn>(conn: &'c Conn, context: Pcontext, string_len: u32, pool: u8, rule: u8, attributes: &'input [String8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
283where
284    Conn: RequestConnection + ?Sized,
285{
286    let request0 = PrintSetAttributesRequest {
287        context,
288        string_len,
289        pool,
290        rule,
291        attributes: Cow::Borrowed(attributes),
292    };
293    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
294    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
295    assert_eq!(slices.len(), bytes.len());
296    conn.send_request_without_reply(&slices, fds).await
297}
298pub async fn print_get_page_dimensions<Conn>(conn: &Conn, context: Pcontext) -> Result<Cookie<'_, Conn, PrintGetPageDimensionsReply>, ConnectionError>
299where
300    Conn: RequestConnection + ?Sized,
301{
302    let request0 = PrintGetPageDimensionsRequest {
303        context,
304    };
305    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
306    let slices = [IoSlice::new(&bytes[0])];
307    assert_eq!(slices.len(), bytes.len());
308    conn.send_request_with_reply(&slices, fds).await
309}
310pub async fn print_query_screens<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, PrintQueryScreensReply>, ConnectionError>
311where
312    Conn: RequestConnection + ?Sized,
313{
314    let request0 = PrintQueryScreensRequest;
315    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
316    let slices = [IoSlice::new(&bytes[0])];
317    assert_eq!(slices.len(), bytes.len());
318    conn.send_request_with_reply(&slices, fds).await
319}
320pub async fn print_set_image_resolution<Conn>(conn: &Conn, context: Pcontext, image_resolution: u16) -> Result<Cookie<'_, Conn, PrintSetImageResolutionReply>, ConnectionError>
321where
322    Conn: RequestConnection + ?Sized,
323{
324    let request0 = PrintSetImageResolutionRequest {
325        context,
326        image_resolution,
327    };
328    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
329    let slices = [IoSlice::new(&bytes[0])];
330    assert_eq!(slices.len(), bytes.len());
331    conn.send_request_with_reply(&slices, fds).await
332}
333pub async fn print_get_image_resolution<Conn>(conn: &Conn, context: Pcontext) -> Result<Cookie<'_, Conn, PrintGetImageResolutionReply>, ConnectionError>
334where
335    Conn: RequestConnection + ?Sized,
336{
337    let request0 = PrintGetImageResolutionRequest {
338        context,
339    };
340    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
341    let slices = [IoSlice::new(&bytes[0])];
342    assert_eq!(slices.len(), bytes.len());
343    conn.send_request_with_reply(&slices, fds).await
344}
345/// Extension trait defining the requests of this extension.
346pub trait ConnectionExt: RequestConnection {
347    fn xprint_print_query_version(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintQueryVersionReply>, ConnectionError>> + Send + '_>>
348    {
349        Box::pin(print_query_version(self))
350    }
351    fn xprint_print_get_printer_list<'c, 'input, 'future>(&'c self, printer_name: &'input [String8], locale: &'input [String8]) -> Pin<Box<dyn Future<Output = Result<Cookie<'c, Self, PrintGetPrinterListReply>, ConnectionError>> + Send + 'future>>
352    where
353        'c: 'future,
354        'input: 'future,
355    {
356        Box::pin(print_get_printer_list(self, printer_name, locale))
357    }
358    fn xprint_print_rehash_printer_list(&self) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
359    {
360        Box::pin(print_rehash_printer_list(self))
361    }
362    fn xprint_create_context<'c, 'input, 'future>(&'c self, context_id: u32, printer_name: &'input [String8], locale: &'input [String8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
363    where
364        'c: 'future,
365        'input: 'future,
366    {
367        Box::pin(create_context(self, context_id, printer_name, locale))
368    }
369    fn xprint_print_set_context(&self, context: u32) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
370    {
371        Box::pin(print_set_context(self, context))
372    }
373    fn xprint_print_get_context(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintGetContextReply>, ConnectionError>> + Send + '_>>
374    {
375        Box::pin(print_get_context(self))
376    }
377    fn xprint_print_destroy_context(&self, context: u32) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
378    {
379        Box::pin(print_destroy_context(self, context))
380    }
381    fn xprint_print_get_screen_of_context(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintGetScreenOfContextReply>, ConnectionError>> + Send + '_>>
382    {
383        Box::pin(print_get_screen_of_context(self))
384    }
385    fn xprint_print_start_job(&self, output_mode: u8) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
386    {
387        Box::pin(print_start_job(self, output_mode))
388    }
389    fn xprint_print_end_job(&self, cancel: bool) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
390    {
391        Box::pin(print_end_job(self, cancel))
392    }
393    fn xprint_print_start_doc(&self, driver_mode: u8) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
394    {
395        Box::pin(print_start_doc(self, driver_mode))
396    }
397    fn xprint_print_end_doc(&self, cancel: bool) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
398    {
399        Box::pin(print_end_doc(self, cancel))
400    }
401    fn xprint_print_put_document_data<'c, 'input, 'future>(&'c self, drawable: xproto::Drawable, data: &'input [u8], doc_format: &'input [String8], options: &'input [String8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
402    where
403        'c: 'future,
404        'input: 'future,
405    {
406        Box::pin(print_put_document_data(self, drawable, data, doc_format, options))
407    }
408    fn xprint_print_get_document_data(&self, context: Pcontext, max_bytes: u32) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintGetDocumentDataReply>, ConnectionError>> + Send + '_>>
409    {
410        Box::pin(print_get_document_data(self, context, max_bytes))
411    }
412    fn xprint_print_start_page(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
413    {
414        Box::pin(print_start_page(self, window))
415    }
416    fn xprint_print_end_page(&self, cancel: bool) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
417    {
418        Box::pin(print_end_page(self, cancel))
419    }
420    fn xprint_print_select_input(&self, context: Pcontext, event_mask: u32) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
421    {
422        Box::pin(print_select_input(self, context, event_mask))
423    }
424    fn xprint_print_input_selected(&self, context: Pcontext) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintInputSelectedReply>, ConnectionError>> + Send + '_>>
425    {
426        Box::pin(print_input_selected(self, context))
427    }
428    fn xprint_print_get_attributes(&self, context: Pcontext, pool: u8) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintGetAttributesReply>, ConnectionError>> + Send + '_>>
429    {
430        Box::pin(print_get_attributes(self, context, pool))
431    }
432    fn xprint_print_get_one_attributes<'c, 'input, 'future>(&'c self, context: Pcontext, pool: u8, name: &'input [String8]) -> Pin<Box<dyn Future<Output = Result<Cookie<'c, Self, PrintGetOneAttributesReply>, ConnectionError>> + Send + 'future>>
433    where
434        'c: 'future,
435        'input: 'future,
436    {
437        Box::pin(print_get_one_attributes(self, context, pool, name))
438    }
439    fn xprint_print_set_attributes<'c, 'input, 'future>(&'c self, context: Pcontext, string_len: u32, pool: u8, rule: u8, attributes: &'input [String8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
440    where
441        'c: 'future,
442        'input: 'future,
443    {
444        Box::pin(print_set_attributes(self, context, string_len, pool, rule, attributes))
445    }
446    fn xprint_print_get_page_dimensions(&self, context: Pcontext) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintGetPageDimensionsReply>, ConnectionError>> + Send + '_>>
447    {
448        Box::pin(print_get_page_dimensions(self, context))
449    }
450    fn xprint_print_query_screens(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintQueryScreensReply>, ConnectionError>> + Send + '_>>
451    {
452        Box::pin(print_query_screens(self))
453    }
454    fn xprint_print_set_image_resolution(&self, context: Pcontext, image_resolution: u16) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintSetImageResolutionReply>, ConnectionError>> + Send + '_>>
455    {
456        Box::pin(print_set_image_resolution(self, context, image_resolution))
457    }
458    fn xprint_print_get_image_resolution(&self, context: Pcontext) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, PrintGetImageResolutionReply>, ConnectionError>> + Send + '_>>
459    {
460        Box::pin(print_get_image_resolution(self, context))
461    }
462}
463
464impl<C: RequestConnection + ?Sized> ConnectionExt for C {}