[INFO] cloning repository https://github.com/Drakulix/nvscreencopy [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/Drakulix/nvscreencopy" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FDrakulix%2Fnvscreencopy", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FDrakulix%2Fnvscreencopy'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] a0c4ddbf2be38808f217623b2d496e156305858f [INFO] checking Drakulix/nvscreencopy/a0c4ddbf2be38808f217623b2d496e156305858f against master#ab869e094a907cc5d19b4080f22eccaf347f1f95 for pr-129604 [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FDrakulix%2Fnvscreencopy" "/workspace/builds/worker-7-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-7-tc1/source'... [INFO] [stderr] done. [INFO] validating manifest of git repo https://github.com/Drakulix/nvscreencopy on toolchain ab869e094a907cc5d19b4080f22eccaf347f1f95 [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+ab869e094a907cc5d19b4080f22eccaf347f1f95" "metadata" "--manifest-path" "Cargo.toml" "--no-deps", kill_on_drop: false }` [INFO] started tweaking git repo https://github.com/Drakulix/nvscreencopy [INFO] finished tweaking git repo https://github.com/Drakulix/nvscreencopy [INFO] tweaked toml for git repo https://github.com/Drakulix/nvscreencopy written to /workspace/builds/worker-7-tc1/source/Cargo.toml [INFO] crate git repo https://github.com/Drakulix/nvscreencopy already has a lockfile, it will not be regenerated [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+ab869e094a907cc5d19b4080f22eccaf347f1f95" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] [stderr] Updating crates.io index [INFO] [stderr] Downloading crates ... [INFO] [stderr] Downloaded xkbcommon v0.4.0 [INFO] [stderr] Downloaded wayland-sys v0.29.0 [INFO] [stderr] Downloaded wayland-server v0.29.0 [INFO] [stderr] Downloaded appendlist v1.4.0 [INFO] [stderr] Downloaded drm-fourcc v2.1.1 [INFO] [stderr] Downloaded slog-async v2.6.0 [INFO] [stderr] Downloaded wayland-commons v0.29.0 [INFO] [stderr] Downloaded anyhow v1.0.42 [INFO] [stderr] Downloaded slog-term v2.8.0 [INFO] [stderr] Downloaded input v0.6.0 [INFO] [stderr] Downloaded arc-swap v1.3.0 [INFO] [stderr] Downloaded calloop v0.9.0 [INFO] [stderr] Downloaded wayland-protocols v0.29.0 [INFO] [stderr] Downloaded smithay-client-toolkit v0.14.0 [INFO] [stderr] Downloaded nom v6.2.1 [INFO] [stderr] Downloaded drm v0.5.0 [INFO] [stderr] Downloaded nix v0.21.0 [INFO] [stderr] Downloaded nix v0.22.0 [INFO] [stderr] Downloaded smithay v0.3.0 [INFO] [stderr] Downloaded nix v0.19.1 [INFO] [stderr] Downloaded calloop v0.7.2 [INFO] [stderr] Downloaded scan_fmt v0.2.6 [INFO] [stderr] Downloaded slog-scope v4.4.0 [INFO] [stderr] Downloaded slog-stdlog v4.1.0 [INFO] [stderr] Downloaded udev v0.6.2 [INFO] [stderr] Downloaded wayland-scanner v0.29.0 [INFO] [stderr] Downloaded drm-ffi v0.2.0 [INFO] [stderr] Downloaded input-sys v1.15.1 [INFO] [stderr] Downloaded drm-sys v0.1.1 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:923055f121b5182466d55868a8b05e67af8ba4a3a3f6bad814e953ca3cd3ac2a" "/opt/rustwide/cargo-home/bin/cargo" "+ab869e094a907cc5d19b4080f22eccaf347f1f95" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] c41bbdb0d00fb647ca81567873af71c52d07d1d6e0cb5f5b388871401c128e3d [INFO] running `Command { std: "docker" "start" "-a" "c41bbdb0d00fb647ca81567873af71c52d07d1d6e0cb5f5b388871401c128e3d", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "c41bbdb0d00fb647ca81567873af71c52d07d1d6e0cb5f5b388871401c128e3d", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "c41bbdb0d00fb647ca81567873af71c52d07d1d6e0cb5f5b388871401c128e3d", kill_on_drop: false }` [INFO] [stdout] c41bbdb0d00fb647ca81567873af71c52d07d1d6e0cb5f5b388871401c128e3d [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:923055f121b5182466d55868a8b05e67af8ba4a3a3f6bad814e953ca3cd3ac2a" "/opt/rustwide/cargo-home/bin/cargo" "+ab869e094a907cc5d19b4080f22eccaf347f1f95" "check" "--frozen" "--all" "--all-targets" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 5be85a7c37ca28a8e089fd942da5065dbfdfef4bd90cf69d3d7ecd6e5ffc5189 [INFO] running `Command { std: "docker" "start" "-a" "5be85a7c37ca28a8e089fd942da5065dbfdfef4bd90cf69d3d7ecd6e5ffc5189", kill_on_drop: false }` [INFO] [stderr] Compiling libc v0.2.98 [INFO] [stderr] Compiling proc-macro2 v1.0.28 [INFO] [stderr] Compiling unicode-xid v0.2.2 [INFO] [stderr] Compiling xml-rs v0.8.3 [INFO] [stderr] Compiling autocfg v1.0.1 [INFO] [stderr] Compiling bitflags v1.2.1 [INFO] [stderr] Compiling pkg-config v0.3.19 [INFO] [stderr] Compiling log v0.4.14 [INFO] [stderr] Checking once_cell v1.8.0 [INFO] [stderr] Checking smallvec v1.6.1 [INFO] [stderr] Compiling khronos_api v3.1.0 [INFO] [stderr] Compiling slog v2.7.0 [INFO] [stderr] Checking downcast-rs v1.2.0 [INFO] [stderr] Checking libloading v0.7.0 [INFO] [stderr] Compiling version_check v0.9.3 [INFO] [stderr] Compiling memchr v2.3.4 [INFO] [stderr] Compiling drm-sys v0.1.1 [INFO] [stderr] Compiling syn v1.0.74 [INFO] [stderr] Checking dlib v0.5.0 [INFO] [stderr] Checking ppv-lite86 v0.2.10 [INFO] [stderr] Compiling drm-fourcc v2.1.1 [INFO] [stderr] Compiling input-sys v1.15.1 [INFO] [stderr] Compiling crossbeam-utils v0.8.5 [INFO] [stderr] Compiling nom v6.2.1 [INFO] [stderr] Checking scoped-tls v1.0.0 [INFO] [stderr] Compiling cgmath v0.18.0 [INFO] [stderr] Checking arc-swap v1.3.0 [INFO] [stderr] Compiling memoffset v0.6.4 [INFO] [stderr] Compiling num-traits v0.2.14 [INFO] [stderr] Compiling num-integer v0.1.44 [INFO] [stderr] Checking thread_local v1.1.3 [INFO] [stderr] Checking remove_dir_all v0.5.3 [INFO] [stderr] Checking unicode-width v0.1.8 [INFO] [stderr] Checking slog-scope v4.4.0 [INFO] [stderr] Compiling wayland-sys v0.28.6 [INFO] [stderr] Compiling wayland-sys v0.29.0 [INFO] [stderr] Compiling libudev-sys v0.1.4 [INFO] [stderr] Compiling anyhow v1.0.42 [INFO] [stderr] Checking vec_map v0.8.2 [INFO] [stderr] Checking textwrap v0.11.0 [INFO] [stderr] Checking appendlist v1.4.0 [INFO] [stderr] Compiling gl_generator v0.14.0 [INFO] [stderr] Checking slog-stdlog v4.1.0 [INFO] [stderr] Checking take_mut v0.2.2 [INFO] [stderr] Checking ansi_term v0.11.0 [INFO] [stderr] Checking strsim v0.8.0 [INFO] [stderr] Checking scan_fmt v0.2.6 [INFO] [stderr] Compiling quote v1.0.9 [INFO] [stderr] Checking crossbeam-channel v0.5.1 [INFO] [stderr] Compiling wayland-scanner v0.28.6 [INFO] [stderr] Compiling wayland-scanner v0.29.0 [INFO] [stderr] Checking slog-async v2.6.0 [INFO] [stderr] Compiling smithay v0.3.0 [INFO] [stderr] Checking approx v0.4.0 [INFO] [stderr] Checking nix v0.22.0 [INFO] [stderr] Checking nix v0.20.0 [INFO] [stderr] Checking getrandom v0.2.3 [INFO] [stderr] Checking dirs-sys-next v0.1.2 [INFO] [stderr] Checking atty v0.2.14 [INFO] [stderr] Checking nix v0.19.1 [INFO] [stderr] Checking time v0.1.43 [INFO] [stderr] Checking udev v0.6.2 [INFO] [stderr] Checking dirs-next v2.0.0 [INFO] [stderr] Checking rand_core v0.6.3 [INFO] [stderr] Checking nix v0.21.0 [INFO] [stderr] Checking term v0.7.0 [INFO] [stderr] Checking xkbcommon v0.4.0 [INFO] [stderr] Checking input v0.6.0 [INFO] [stderr] Checking rand_chacha v0.3.1 [INFO] [stderr] Checking chrono v0.4.19 [INFO] [stderr] Checking memmap2 v0.2.3 [INFO] [stderr] Checking clap v2.33.3 [INFO] [stderr] Checking xcursor v0.3.3 [INFO] [stderr] Checking rand v0.8.4 [INFO] [stderr] Compiling wayland-server v0.29.0 [INFO] [stderr] Compiling wayland-protocols v0.29.0 [INFO] [stderr] Compiling wayland-client v0.28.6 [INFO] [stderr] Compiling wayland-protocols v0.28.6 [INFO] [stderr] Compiling nvscreencopy v0.1.0 (/opt/rustwide/workdir) [INFO] [stderr] Checking slog-term v2.8.0 [INFO] [stderr] Checking tempfile v3.2.0 [INFO] [stderr] Compiling thiserror-impl v1.0.26 [INFO] [stderr] Checking thiserror v1.0.26 [INFO] [stderr] Checking calloop v0.7.2 [INFO] [stderr] Checking wayland-commons v0.28.6 [INFO] [stderr] Checking wayland-commons v0.29.0 [INFO] [stderr] Checking drm-ffi v0.2.0 [INFO] [stderr] Checking calloop v0.9.0 [INFO] [stderr] Checking drm v0.5.0 [INFO] [stderr] Checking wayland-cursor v0.28.6 [INFO] [stderr] Checking smithay-client-toolkit v0.14.0 [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:18892 [INFO] [stdout] | [INFO] [stdout] 1 | ..._interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] = note: `#[warn(static_mut_refs)]` on by default [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { addr_of!(super :: wl_buffer :: wl_buffer_interface) as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:18892 [INFO] [stdout] | [INFO] [stdout] 1 | ..._interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] = note: `#[warn(static_mut_refs)]` on by default [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { addr_of!(super :: wl_buffer :: wl_buffer_interface) as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:19233 [INFO] [stdout] | [INFO] [stdout] 1 | ...interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { addr_of!(super :: wl_buffer :: wl_buffer_interface) as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:19233 [INFO] [stdout] | [INFO] [stdout] 1 | ...interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { addr_of!(super :: wl_buffer :: wl_buffer_interface) as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:19743 [INFO] [stdout] | [INFO] [stdout] 1 | ...interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { addr_of!(super :: wl_buffer :: wl_buffer_interface) as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:19743 [INFO] [stdout] | [INFO] [stdout] 1 | ...interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { addr_of!(super :: wl_buffer :: wl_buffer_interface) as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:20431 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as *... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:20431 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as *... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:20613 [INFO] [stdout] | [INFO] [stdout] 1 | ...onst c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { addr_of!(wl_drm_requests_create_buffer_types) as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:20832 [INFO] [stdout] | [INFO] [stdout] 1 | ... c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { addr_of!(wl_drm_requests_create_planar_buffer_types) as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:20613 [INFO] [stdout] | [INFO] [stdout] 1 | ...onst c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { addr_of!(wl_drm_requests_create_buffer_types) as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21058 [INFO] [stdout] | [INFO] [stdout] 1 | ...t c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the me... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { addr_of!(wl_drm_requests_create_prime_buffer_types) as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:20832 [INFO] [stdout] | [INFO] [stdout] 1 | ... c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { addr_of!(wl_drm_requests_create_planar_buffer_types) as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21391 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const ... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21561 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as *... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21058 [INFO] [stdout] | [INFO] [stdout] 1 | ...t c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the me... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { addr_of!(wl_drm_requests_create_prime_buffer_types) as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21737 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * ... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21391 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const ... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21913 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for in... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21561 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as *... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:22183 [INFO] [stdout] | [INFO] [stdout] 1 | ... request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * c... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { addr_of!(wl_drm_requests) as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21737 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * ... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:22254 [INFO] [stdout] | [INFO] [stdout] 1 | ..._ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { addr_of!(wl_drm_events) as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:21913 [INFO] [stdout] | [INFO] [stdout] 1 | ...st u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for in... [INFO] [stdout] | ^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { addr_of!(types_null) as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:22183 [INFO] [stdout] | [INFO] [stdout] 1 | ... request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * c... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { addr_of!(wl_drm_requests) as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:22254 [INFO] [stdout] | [INFO] [stdout] 1 | ..._ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { addr_of!(wl_drm_events) as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:16253 [INFO] [stdout] | [INFO] [stdout] 1 | ...e () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { addr_of!(wl_drm_interface) } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: creating a shared reference to mutable static is discouraged [INFO] [stdout] --> /opt/rustwide/target/debug/build/nvscreencopy-3cbf75df058a77c7/out/drm.rs:1:16253 [INFO] [stdout] | [INFO] [stdout] 1 | ...e () -> * const wl_interface { unsafe { & wl_drm_interface } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ shared reference to mutable static [INFO] [stdout] | [INFO] [stdout] = note: for more information, see issue #114447 [INFO] [stdout] = note: this will be a hard error in the 2024 edition [INFO] [stdout] = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior [INFO] [stdout] help: use `addr_of!` instead to create a raw pointer [INFO] [stdout] | [INFO] [stdout] 1 | use std :: os :: raw :: { c_char , c_void } ; const NULLPTR : * const c_void = 0 as * const c_void ; static mut types_null : [* const sys :: common :: wl_interface ; 1] = [NULLPTR as * const sys :: common :: wl_interface ,] ; pub mod wl_drm { use std :: os :: raw :: c_char ; use super :: { Proxy , AnonymousObject , Interface , MessageGroup , MessageDesc , ArgumentType , Object , Message , Argument , ObjectMetadata , types_null , NULLPTR , Main , smallvec , } ; use super :: sys :: common :: { wl_interface , wl_array , wl_argument , wl_message } ; use super :: sys :: client :: * ; # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Error { AuthenticateFail = 0 , InvalidFormat = 1 , InvalidName = 2 , } impl Error { pub fn from_raw (n : u32) -> Option < Error > { match n { 0 => Some (Error :: AuthenticateFail) , 1 => Some (Error :: InvalidFormat) , 2 => Some (Error :: InvalidName) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Format { C8 = 538982467 , Rgb332 = 943867730 , Bgr233 = 944916290 , Xrgb4444 = 842093144 , Xbgr4444 = 842089048 , Rgbx4444 = 842094674 , Bgrx4444 = 842094658 , Argb4444 = 842093121 , Abgr4444 = 842089025 , Rgba4444 = 842088786 , Bgra4444 = 842088770 , Xrgb1555 = 892424792 , Xbgr1555 = 892420696 , Rgbx5551 = 892426322 , Bgrx5551 = 892426306 , Argb1555 = 892424769 , Abgr1555 = 892420673 , Rgba5551 = 892420434 , Bgra5551 = 892420418 , Rgb565 = 909199186 , Bgr565 = 909199170 , Rgb888 = 875710290 , Bgr888 = 875710274 , Xrgb8888 = 875713112 , Xbgr8888 = 875709016 , Rgbx8888 = 875714642 , Bgrx8888 = 875714626 , Argb8888 = 875713089 , Abgr8888 = 875708993 , Rgba8888 = 875708754 , Bgra8888 = 875708738 , Xrgb2101010 = 808669784 , Xbgr2101010 = 808665688 , Rgbx1010102 = 808671314 , Bgrx1010102 = 808671298 , Argb2101010 = 808669761 , Abgr2101010 = 808665665 , Rgba1010102 = 808665426 , Bgra1010102 = 808665410 , Yuyv = 1448695129 , Yvyu = 1431918169 , Uyvy = 1498831189 , Vyuy = 1498765654 , Ayuv = 1448433985 , Xyuv8888 = 1448434008 , Nv12 = 842094158 , Nv21 = 825382478 , Nv16 = 909203022 , Nv61 = 825644622 , Yuv410 = 961959257 , Yvu410 = 961893977 , Yuv411 = 825316697 , Yvu411 = 825316953 , Yuv420 = 842093913 , Yvu420 = 842094169 , Yuv422 = 909202777 , Yvu422 = 909203033 , Yuv444 = 875713881 , Yvu444 = 875714137 , Abgr16f = 1211384385 , Xbgr16f = 1211384408 , } impl Format { pub fn from_raw (n : u32) -> Option < Format > { match n { 538982467 => Some (Format :: C8) , 943867730 => Some (Format :: Rgb332) , 944916290 => Some (Format :: Bgr233) , 842093144 => Some (Format :: Xrgb4444) , 842089048 => Some (Format :: Xbgr4444) , 842094674 => Some (Format :: Rgbx4444) , 842094658 => Some (Format :: Bgrx4444) , 842093121 => Some (Format :: Argb4444) , 842089025 => Some (Format :: Abgr4444) , 842088786 => Some (Format :: Rgba4444) , 842088770 => Some (Format :: Bgra4444) , 892424792 => Some (Format :: Xrgb1555) , 892420696 => Some (Format :: Xbgr1555) , 892426322 => Some (Format :: Rgbx5551) , 892426306 => Some (Format :: Bgrx5551) , 892424769 => Some (Format :: Argb1555) , 892420673 => Some (Format :: Abgr1555) , 892420434 => Some (Format :: Rgba5551) , 892420418 => Some (Format :: Bgra5551) , 909199186 => Some (Format :: Rgb565) , 909199170 => Some (Format :: Bgr565) , 875710290 => Some (Format :: Rgb888) , 875710274 => Some (Format :: Bgr888) , 875713112 => Some (Format :: Xrgb8888) , 875709016 => Some (Format :: Xbgr8888) , 875714642 => Some (Format :: Rgbx8888) , 875714626 => Some (Format :: Bgrx8888) , 875713089 => Some (Format :: Argb8888) , 875708993 => Some (Format :: Abgr8888) , 875708754 => Some (Format :: Rgba8888) , 875708738 => Some (Format :: Bgra8888) , 808669784 => Some (Format :: Xrgb2101010) , 808665688 => Some (Format :: Xbgr2101010) , 808671314 => Some (Format :: Rgbx1010102) , 808671298 => Some (Format :: Bgrx1010102) , 808669761 => Some (Format :: Argb2101010) , 808665665 => Some (Format :: Abgr2101010) , 808665426 => Some (Format :: Rgba1010102) , 808665410 => Some (Format :: Bgra1010102) , 1448695129 => Some (Format :: Yuyv) , 1431918169 => Some (Format :: Yvyu) , 1498831189 => Some (Format :: Uyvy) , 1498765654 => Some (Format :: Vyuy) , 1448433985 => Some (Format :: Ayuv) , 1448434008 => Some (Format :: Xyuv8888) , 842094158 => Some (Format :: Nv12) , 825382478 => Some (Format :: Nv21) , 909203022 => Some (Format :: Nv16) , 825644622 => Some (Format :: Nv61) , 961959257 => Some (Format :: Yuv410) , 961893977 => Some (Format :: Yvu410) , 825316697 => Some (Format :: Yuv411) , 825316953 => Some (Format :: Yvu411) , 842093913 => Some (Format :: Yuv420) , 842094169 => Some (Format :: Yvu420) , 909202777 => Some (Format :: Yuv422) , 909203033 => Some (Format :: Yvu422) , 875713881 => Some (Format :: Yuv444) , 875714137 => Some (Format :: Yvu444) , 1211384385 => Some (Format :: Abgr16f) , 1211384408 => Some (Format :: Xbgr16f) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [doc = "wl_drm capability bitmask\n\nBitmask of capabilities."] # [repr (u32)] # [derive (Copy , Clone , Debug , PartialEq)] # [non_exhaustive] pub enum Capability { # [doc = "wl_drm prime available"] Prime = 1 , } impl Capability { pub fn from_raw (n : u32) -> Option < Capability > { match n { 1 => Some (Capability :: Prime) , _ => Option :: None } } pub fn to_raw (& self) -> u32 { * self as u32 } } # [derive (Debug)] # [non_exhaustive] pub enum Request { # [doc = ""] Authenticate { id : u32 , } , # [doc = ""] CreateBuffer { name : u32 , width : i32 , height : i32 , stride : u32 , format : u32 , } , # [doc = ""] CreatePlanarBuffer { name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , # [doc = "Only available since version 2 of the interface"] CreatePrimeBuffer { name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32 , } , } impl super :: MessageGroup for Request { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "authenticate" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "create_planar_buffer" , since : 1 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } , super :: MessageDesc { name : "create_prime_buffer" , since : 2 , signature : & [super :: ArgumentType :: NewId , super :: ArgumentType :: Fd , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Uint , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int , super :: ArgumentType :: Int ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Request :: Authenticate { .. } => 0 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 2 , Request :: CreatePrimeBuffer { .. } => 3 , } } fn since (& self) -> u32 { match * self { Request :: Authenticate { .. } => 1 , Request :: CreateBuffer { .. } => 1 , Request :: CreatePlanarBuffer { .. } => 1 , Request :: CreatePrimeBuffer { .. } => 2 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { 1 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 2 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , 3 => Some (Object :: from_interface :: < super :: wl_buffer :: WlBuffer > (version , meta . child () ,)) , _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { panic ! ("Request::from_raw can not be used Client-side.") } fn into_raw (self , sender_id : u32) -> Message { match self { Request :: Authenticate { id } => Message { sender_id : sender_id , opcode : 0 , args : smallvec ! [Argument :: Uint (id) ,] , } , Request :: CreateBuffer { name , width , height , stride , format } => Message { sender_id : sender_id , opcode : 1 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (stride) , Argument :: Uint (format) ,] , } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 2 , args : smallvec ! [Argument :: NewId (0) , Argument :: Uint (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => Message { sender_id : sender_id , opcode : 3 , args : smallvec ! [Argument :: NewId (0) , Argument :: Fd (name) , Argument :: Int (width) , Argument :: Int (height) , Argument :: Uint (format) , Argument :: Int (offset0) , Argument :: Int (stride0) , Argument :: Int (offset1) , Argument :: Int (stride1) , Argument :: Int (offset2) , Argument :: Int (stride2) ,] , } , } } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Request , () > { panic ! ("Request::from_raw_c can not be used Client-side.") } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { match self { Request :: Authenticate { id } => { let mut _args_array : [wl_argument ; 1] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . u = id ; f (0 , & mut _args_array) } , Request :: CreateBuffer { name , width , height , stride , format } => { let mut _args_array : [wl_argument ; 6] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = stride ; _args_array [5] . u = format ; f (1 , & mut _args_array) } , Request :: CreatePlanarBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . u = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (2 , & mut _args_array) } , Request :: CreatePrimeBuffer { name , width , height , format , offset0 , stride0 , offset1 , stride1 , offset2 , stride2 } => { let mut _args_array : [wl_argument ; 11] = unsafe { :: std :: mem :: zeroed () } ; _args_array [0] . o = :: std :: ptr :: null_mut () as * mut _ ; _args_array [1] . h = name ; _args_array [2] . i = width ; _args_array [3] . i = height ; _args_array [4] . u = format ; _args_array [5] . i = offset0 ; _args_array [6] . i = stride0 ; _args_array [7] . i = offset1 ; _args_array [8] . i = stride1 ; _args_array [9] . i = offset2 ; _args_array [10] . i = stride2 ; f (3 , & mut _args_array) } , } } } # [derive (Debug)] # [non_exhaustive] pub enum Event { # [doc = ""] Device { name : String , } , # [doc = ""] Format { format : u32 , } , # [doc = ""] Authenticated , # [doc = ""] Capabilities { value : u32 , } , } impl super :: MessageGroup for Event { const MESSAGES : & 'static [super :: MessageDesc] = & [super :: MessageDesc { name : "device" , since : 1 , signature : & [super :: ArgumentType :: Str ,] , destructor : false , } , super :: MessageDesc { name : "format" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } , super :: MessageDesc { name : "authenticated" , since : 1 , signature : & [] , destructor : false , } , super :: MessageDesc { name : "capabilities" , since : 1 , signature : & [super :: ArgumentType :: Uint ,] , destructor : false , } ,] ; type Map = super :: ProxyMap ; fn is_destructor (& self) -> bool { match * self { _ => false , } } fn opcode (& self) -> u16 { match * self { Event :: Device { .. } => 0 , Event :: Format { .. } => 1 , Event :: Authenticated => 2 , Event :: Capabilities { .. } => 3 , } } fn since (& self) -> u32 { match * self { Event :: Device { .. } => 1 , Event :: Format { .. } => 1 , Event :: Authenticated => 1 , Event :: Capabilities { .. } => 1 , } } fn child < Meta : ObjectMetadata > (opcode : u16 , version : u32 , meta : & Meta) -> Option < Object < Meta >> { match opcode { _ => None , } } fn from_raw (msg : Message , map : & mut Self :: Map) -> Result < Self , () > { match msg . opcode { 0 => { let mut args = msg . args . into_iter () ; Ok (Event :: Device { name : { if let Some (Argument :: Str (val)) = args . next () { let s = String :: from_utf8 (val . into_bytes ()) . unwrap_or_else (| e | String :: from_utf8_lossy (& e . into_bytes ()) . into ()) ; s } else { return Err (()) ; } } , }) } , 1 => { let mut args = msg . args . into_iter () ; Ok (Event :: Format { format : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , 2 => Ok (Event :: Authenticated) , 3 => { let mut args = msg . args . into_iter () ; Ok (Event :: Capabilities { value : { if let Some (Argument :: Uint (val)) = args . next () { val } else { return Err (()) ; } } , }) } , _ => Err (()) , } } fn into_raw (self , sender_id : u32) -> Message { panic ! ("Event::into_raw can not be used Client-side.") } unsafe fn from_raw_c (obj : * mut :: std :: os :: raw :: c_void , opcode : u32 , args : * const wl_argument ,) -> Result < Event , () > { match opcode { 0 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Device { name : :: std :: ffi :: CStr :: from_ptr (_args [0] . s) . to_string_lossy () . into_owned () , }) } , 1 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Format { format : _args [0] . u , }) } , 2 => { Ok (Event :: Authenticated) } , 3 => { let _args = :: std :: slice :: from_raw_parts (args , 1) ; Ok (Event :: Capabilities { value : _args [0] . u , }) } , _ => return Err (()) , } } fn as_raw_c_in < F , T > (self , f : F) -> T where F : FnOnce (u32 , & mut [wl_argument]) -> T { panic ! ("Event::as_raw_c_in can not be used Client-side.") } } # [derive (Clone , Eq , PartialEq)] pub struct WlDrm (Proxy < WlDrm >) ; impl AsRef < Proxy < WlDrm >> for WlDrm { # [inline] fn as_ref (& self) -> & Proxy < Self > { & self . 0 } } impl From < Proxy < WlDrm >> for WlDrm { # [inline] fn from (value : Proxy < Self >) -> Self { WlDrm (value) } } impl From < WlDrm > for Proxy < WlDrm > { # [inline] fn from (value : WlDrm) -> Self { value . 0 } } impl std :: fmt :: Debug for WlDrm { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { f . write_fmt (format_args ! ("{:?}" , self . 0)) } } impl Interface for WlDrm { type Request = Request ; type Event = Event ; const NAME : & 'static str = "wl_drm" ; const VERSION : u32 = 2 ; fn c_interface () -> * const wl_interface { unsafe { addr_of!(wl_drm_interface) } } } impl WlDrm { # [doc = ""] pub fn authenticate (& self , id : u32) -> () { let msg = Request :: Authenticate { id : id } ; self . 0 . send :: < AnonymousObject > (msg , None) ; } # [doc = ""] pub fn create_buffer (& self , name : u32 , width : i32 , height : i32 , stride : u32 , format : u32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreateBuffer { name : name , width : width , height : height , stride : stride , format : format } ; self . 0 . send (msg , None) . unwrap () } # [doc = ""] pub fn create_planar_buffer (& self , name : u32 , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePlanarBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } # [doc = "Only available since version 2 of the interface."] pub fn create_prime_buffer (& self , name : :: std :: os :: unix :: io :: RawFd , width : i32 , height : i32 , format : u32 , offset0 : i32 , stride0 : i32 , offset1 : i32 , stride1 : i32 , offset2 : i32 , stride2 : i32) -> Main < super :: wl_buffer :: WlBuffer > { let msg = Request :: CreatePrimeBuffer { name : name , width : width , height : height , format : format , offset0 : offset0 , stride0 : stride0 , offset1 : offset1 , stride1 : stride1 , offset2 : offset2 , stride2 : stride2 } ; self . 0 . send (msg , None) . unwrap () } } # [doc = r" The minimal object version supporting this request"] pub const REQ_AUTHENTICATE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PLANAR_BUFFER_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this request"] pub const REQ_CREATE_PRIME_BUFFER_SINCE : u32 = 2u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_DEVICE_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_FORMAT_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_AUTHENTICATED_SINCE : u32 = 1u32 ; # [doc = r" The minimal object version supporting this event"] pub const EVT_CAPABILITIES_SINCE : u32 = 1u32 ; static mut wl_drm_requests_create_buffer_types : [* const wl_interface ; 6] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_planar_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; static mut wl_drm_requests_create_prime_buffer_types : [* const wl_interface ; 11] = [unsafe { & super :: wl_buffer :: wl_buffer_interface as * const wl_interface } , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface , NULLPTR as * const wl_interface ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_requests : [wl_message ; 4] = [wl_message { name : b"authenticate\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"create_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuu\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_buffer_types as * const _ } , } , wl_message { name : b"create_planar_buffer\0" as * const u8 as * const c_char , signature : b"nuiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_planar_buffer_types as * const _ } , } , wl_message { name : b"create_prime_buffer\0" as * const u8 as * const c_char , signature : b"2nhiiuiiiiii\0" as * const u8 as * const c_char , types : unsafe { & wl_drm_requests_create_prime_buffer_types as * const _ } , } ,] ; # [doc = r" C-representation of the messages of this interface, for interop"] pub static mut wl_drm_events : [wl_message ; 4] = [wl_message { name : b"device\0" as * const u8 as * const c_char , signature : b"s\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"format\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"authenticated\0" as * const u8 as * const c_char , signature : b"\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } , wl_message { name : b"capabilities\0" as * const u8 as * const c_char , signature : b"u\0" as * const u8 as * const c_char , types : unsafe { & types_null as * const _ } , } ,] ; # [doc = r" C representation of this interface, for interop"] pub static mut wl_drm_interface : wl_interface = wl_interface { name : b"wl_drm\0" as * const u8 as * const c_char , version : 2 , request_count : 4 , requests : unsafe { & wl_drm_requests as * const _ } , event_count : 4 , events : unsafe { & wl_drm_events as * const _ } , } ; } [INFO] [stdout] | ~~~~~~~~~ + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variable does not need to be mutable [INFO] [stdout] --> src/main.rs:89:9 [INFO] [stdout] | [INFO] [stdout] 89 | let mut state: &mut WaylandState = data.get().unwrap(); [INFO] [stdout] | ----^^^^^ [INFO] [stdout] | | [INFO] [stdout] | help: remove this `mut` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_mut)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variable does not need to be mutable [INFO] [stdout] --> src/main.rs:89:9 [INFO] [stdout] | [INFO] [stdout] 89 | let mut state: &mut WaylandState = data.get().unwrap(); [INFO] [stdout] | ----^^^^^ [INFO] [stdout] | | [INFO] [stdout] | help: remove this `mut` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_mut)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: 15 warnings emitted [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: 15 warnings emitted [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 33.81s [INFO] [stderr] warning: the following packages contain code that will be rejected by a future version of Rust: nom v6.2.1 [INFO] [stderr] note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1` [INFO] running `Command { std: "docker" "inspect" "5be85a7c37ca28a8e089fd942da5065dbfdfef4bd90cf69d3d7ecd6e5ffc5189", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "5be85a7c37ca28a8e089fd942da5065dbfdfef4bd90cf69d3d7ecd6e5ffc5189", kill_on_drop: false }` [INFO] [stdout] 5be85a7c37ca28a8e089fd942da5065dbfdfef4bd90cf69d3d7ecd6e5ffc5189