Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclosed delimiter #291

Closed
bjorn3 opened this issue Feb 3, 2020 · 9 comments
Closed

Unclosed delimiter #291

bjorn3 opened this issue Feb 3, 2020 · 9 comments

Comments

@bjorn3
Copy link
Contributor

bjorn3 commented Feb 3, 2020

   Compiling wayland-protocols v0.23.6
error: unexpected closing delimiter: `}`
   --> target/release/build/wayland-protocols-77db614f81d63496/out/fullscreen-shell-v1_client_api.rs:700:1
    |
632 |         fn capability(&mut self, object: ZwpFullscreenShellV1, capability: u32) {}
    |                                                                                 -- this block is empty, you might have not meant to close it
...
700 | }
    | ^ unexpected closing delimiter

error: aborting due to previous error

error: could not compile `wayland-protocols`.
Generated file
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];
///displays a single surface per output
///
///Displays a single surface per output.
///
///This interface provides a mechanism for a single client to display
///simple full-screen surfaces.  While there technically may be multiple
///clients bound to this interface, only one of those clients should be
///shown at a time.
///
///To present a surface, the client uses either the present_surface or
///present_surface_for_mode requests.  Presenting a surface takes effect
///on the next wl_surface.commit.  See the individual requests for
///details about scaling and mode switches.
///
///The client can have at most one surface per output at any time.
///Requesting a surface to be presented on an output that already has a
///surface replaces the previously presented surface.  Presenting a null
///surface removes its content and effectively disables the output.
///Exactly what happens when an output is "disabled" is
///compositor-specific.  The same surface may be presented on multiple
///outputs simultaneously.
///
///Once a surface is presented on an output, it stays on that output
///until either the client removes it or the compositor destroys the
///output.  This way, the client can update the output's contents by
///simply attaching a new buffer.
///
///Warning! The protocol described in this file is experimental and
///backward incompatible changes may be made. Backward compatible changes
///may be added together with the corresponding interface version bump.
///Backward incompatible changes are done by bumping the version number in
///the protocol and interface names and resetting the interface version.
///Once the protocol is to be declared stable, the 'z' prefix and the
///version number in the protocol and interface names are removed and the
///interface version number is reset.
pub mod zwp_fullscreen_shell_v1 {
    use super::{
        sys::{
            client::*,
            common::{wl_argument, wl_array, wl_interface, wl_message},
        },
        types_null, AnonymousObject, Argument, ArgumentType, HandledBy, Interface, Message,
        MessageDesc, MessageGroup, NewProxy, Object, ObjectMetadata, Proxy, NULLPTR,
    };
    use std::os::raw::c_char;
    ///capabilities advertised by the compositor
    ///
    ///Various capabilities that can be advertised by the compositor.  They
    ///are advertised one-at-a-time when the wl_fullscreen_shell interface is
    ///bound.  See the wl_fullscreen_shell.capability event for more details.
    ///
    ///ARBITRARY_MODES:
    ///This is a hint to the client that indicates that the compositor is
    ///capable of setting practically any mode on its outputs.  If this
    ///capability is provided, wl_fullscreen_shell.present_surface_for_mode
    ///will almost never fail and clients should feel free to set whatever
    ///mode they like.  If the compositor does not advertise this, it may
    ///still support some modes that are not advertised through wl_global.mode
    ///but it is less likely.
    ///
    ///CURSOR_PLANE:
    ///This is a hint to the client that indicates that the compositor can
    ///handle a cursor surface from the client without actually compositing.
    ///This may be because of a hardware cursor plane or some other mechanism.
    ///If the compositor does not advertise this capability then setting
    ///wl_pointer.cursor may degrade performance or be ignored entirely.  If
    ///CURSOR_PLANE is not advertised, it is recommended that the client draw
    ///its own cursor and set wl_pointer.cursor(NULL).
    #[repr(u32)]
    #[derive(Copy, Clone, Debug, PartialEq)]
    pub enum Capability {
        ///compositor is capable of almost any output mode
        ArbitraryModes = 1,
        ///compositor has a separate cursor plane
        CursorPlane = 2,
        #[doc(hidden)]
        __nonexhaustive,
    }
    impl Capability {
        pub fn from_raw(n: u32) -> Option<Capability> {
            match n {
                1 => Some(Capability::ArbitraryModes),
                2 => Some(Capability::CursorPlane),
                _ => Option::None,
            }
        }

        pub fn to_raw(&self) -> u32 { *self as u32 }
    }
    ///different method to set the surface fullscreen
    ///
    ///Hints to indicate to the compositor how to deal with a conflict
    ///between the dimensions of the surface and the dimensions of the
    ///output. The compositor is free to ignore this parameter.
    #[repr(u32)]
    #[derive(Copy, Clone, Debug, PartialEq)]
    pub enum PresentMethod {
        ///no preference, apply default policy
        Default = 0,
        ///center the surface on the output
        Center = 1,
        ///scale the surface, preserving aspect ratio, to the largest size that
        /// will fit on the output
        Zoom = 2,
        ///scale the surface, preserving aspect ratio, to fully fill the output
        /// cropping if needed
        ZoomCrop = 3,
        ///scale the surface to the size of the output ignoring aspect ratio
        Stretch = 4,
        #[doc(hidden)]
        __nonexhaustive,
    }
    impl PresentMethod {
        pub fn from_raw(n: u32) -> Option<PresentMethod> {
            match n {
                0 => Some(PresentMethod::Default),
                1 => Some(PresentMethod::Center),
                2 => Some(PresentMethod::Zoom),
                3 => Some(PresentMethod::ZoomCrop),
                4 => Some(PresentMethod::Stretch),
                _ => Option::None,
            }
        }

        pub fn to_raw(&self) -> u32 { *self as u32 }
    }
    ///wl_fullscreen_shell error values
    ///
    ///These errors can be emitted in response to wl_fullscreen_shell requests.
    #[repr(u32)]
    #[derive(Copy, Clone, Debug, PartialEq)]
    pub enum Error {
        ///present_method is not known
        InvalidMethod = 0,
        #[doc(hidden)]
        __nonexhaustive,
    }
    impl Error {
        pub fn from_raw(n: u32) -> Option<Error> {
            match n {
                0 => Some(Error::InvalidMethod),
                _ => Option::None,
            }
        }

        pub fn to_raw(&self) -> u32 { *self as u32 }
    }
    pub enum Request {
        ///release the wl_fullscreen_shell interface
        ///
        ///Release the binding from the wl_fullscreen_shell interface.
        ///
        ///This destroys the server-side object and frees this binding.  If
        ///the client binds to wl_fullscreen_shell multiple times, it may wish
        ///to free some of those bindings.
        ///
        ///This is a destructor, once sent this object cannot be used any
        /// longer.
        Release,
        ///present surface for display
        ///
        ///Present a surface on the given output.
        ///
        ///If the output is null, the compositor will present the surface on
        ///whatever display (or displays) it thinks best.  In particular, this
        ///may replace any or all surfaces currently presented so it should
        ///not be used in combination with placing surfaces on specific
        ///outputs.
        ///
        ///The method parameter is a hint to the compositor for how the surface
        ///is to be presented.  In particular, it tells the compositor how to
        ///handle a size mismatch between the presented surface and the
        ///output.  The compositor is free to ignore this parameter.
        ///
        ///The "zoom", "zoom_crop", and "stretch" methods imply a scaling
        ///operation on the surface.  This will override any kind of output
        ///scaling, so the buffer_scale property of the surface is effectively
        ///ignored.
        PresentSurface {
            surface: Option<super::wl_surface::WlSurface>,
            method: u32,
            output: Option<super::wl_output::WlOutput>,
        },
        ///present surface for display at a particular mode
        ///
        ///Presents a surface on the given output for a particular mode.
        ///
        ///If the current size of the output differs from that of the surface,
        ///the compositor will attempt to change the size of the output to
        ///match the surface.  The result of the mode-switch operation will be
        ///returned via the provided wl_fullscreen_shell_mode_feedback object.
        ///
        ///If the current output mode matches the one requested or if the
        ///compositor successfully switches the mode to match the surface,
        ///then the mode_successful event will be sent and the output will
        ///contain the contents of the given surface.  If the compositor
        ///cannot match the output size to the surface size, the mode_failed
        ///will be sent and the output will contain the contents of the
        ///previously presented surface (if any).  If another surface is
        ///presented on the given output before either of these has a chance
        ///to happen, the present_cancelled event will be sent.
        ///
        ///Due to race conditions and other issues unknown to the client, no
        ///mode-switch operation is guaranteed to succeed.  However, if the
        ///mode is one advertised by wl_output.mode or if the compositor
        ///advertises the ARBITRARY_MODES capability, then the client should
        ///expect that the mode-switch operation will usually succeed.
        ///
        ///If the size of the presented surface changes, the resulting output
        ///is undefined.  The compositor may attempt to change the output mode
        ///to compensate.  However, there is no guarantee that a suitable mode
        ///will be found and the client has no way to be notified of success
        ///or failure.
        ///
        ///The framerate parameter specifies the desired framerate for the
        ///output in mHz.  The compositor is free to ignore this parameter.  A
        ///value of 0 indicates that the client has no preference.
        ///
        ///If the value of wl_output.scale differs from
        /// wl_surface.buffer_scale, then the compositor may choose a
        /// mode that matches either the buffer size or the surface
        /// size.  In either case, the surface will fill the output.
        PresentSurfaceForMode {
            surface: super::wl_surface::WlSurface,
            output: super::wl_output::WlOutput,
            framerate: i32,
            feedback:
                super::zwp_fullscreen_shell_mode_feedback_v1::ZwpFullscreenShellModeFeedbackV1,
        },
        #[doc(hidden)]
        __nonexhaustive,
    }
    impl super::MessageGroup for Request {
        type Map = super::ProxyMap;

        const MESSAGES: &'static [super::MessageDesc] = &[
            super::MessageDesc {
                name: "release",
                since: 1,
                signature: &[],
            },
            super::MessageDesc {
                name: "present_surface",
                since: 1,
                signature: &[
                    super::ArgumentType::Object,
                    super::ArgumentType::Uint,
                    super::ArgumentType::Object,
                ],
            },
            super::MessageDesc {
                name: "present_surface_for_mode",
                since: 1,
                signature: &[
                    super::ArgumentType::Object,
                    super::ArgumentType::Object,
                    super::ArgumentType::Int,
                    super::ArgumentType::NewId,
                ],
            },
        ];

        fn is_destructor(&self) -> bool {
            match *self {
                Request::__nonexhaustive => unreachable!(),
                Request::Release => true,
                _ => false,
            }
        }

        fn opcode(&self) -> u16 {
            match *self {
                Request::__nonexhaustive => unreachable!(),
                Request::Release => 0,
                Request::PresentSurface { .. } => 1,
                Request::PresentSurfaceForMode { .. } => 2,
            }
        }

        fn since(&self) -> u32 {
            match *self {
                Request::__nonexhaustive => unreachable!(),
                Request::Release => 1,
                Request::PresentSurface { .. } => 1,
                Request::PresentSurfaceForMode { .. } => 1,
            }
        }

        fn child<Meta: ObjectMetadata>(
            opcode: u16,
            version: u32,
            meta: &Meta,
        ) -> Option<Object<Meta>> {
            match opcode {
                2 => Some(Object::from_interface::<
                    super::zwp_fullscreen_shell_mode_feedback_v1::ZwpFullscreenShellModeFeedbackV1,
                >(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::__nonexhaustive => unreachable!(),
                Request::Release => Message {
                    sender_id,
                    opcode: 0,
                    args: vec![],
                },
                Request::PresentSurface {
                    surface,
                    method,
                    output,
                } => Message {
                    sender_id,
                    opcode: 1,
                    args: vec![
                        Argument::Object(surface.map(|o| o.as_ref().id()).unwrap_or(0)),
                        Argument::Uint(method),
                        Argument::Object(output.map(|o| o.as_ref().id()).unwrap_or(0)),
                    ],
                },
                Request::PresentSurfaceForMode {
                    surface,
                    output,
                    framerate,
                    feedback,
                } => Message {
                    sender_id,
                    opcode: 2,
                    args: vec![
                        Argument::Object(surface.as_ref().id()),
                        Argument::Object(output.as_ref().id()),
                        Argument::Int(framerate),
                        Argument::NewId(feedback.as_ref().id()),
                    ],
                },
            }
        }

        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::__nonexhaustive => unreachable!(),
                Request::Release => {
                    let mut _args_array: [wl_argument; 0] = unsafe { ::std::mem::zeroed() };
                    f(0, &mut _args_array)
                },
                Request::PresentSurface {
                    surface,
                    method,
                    output,
                } => {
                    let mut _args_array: [wl_argument; 3] = unsafe { ::std::mem::zeroed() };
                    _args_array[0].o = surface
                        .map(|o| o.as_ref().c_ptr() as *mut _)
                        .unwrap_or(::std::ptr::null_mut());
                    _args_array[1].u = method;
                    _args_array[2].o = output
                        .map(|o| o.as_ref().c_ptr() as *mut _)
                        .unwrap_or(::std::ptr::null_mut());
                    f(1, &mut _args_array)
                },
                Request::PresentSurfaceForMode {
                    surface,
                    output,
                    framerate,
                    feedback,
                } => {
                    let mut _args_array: [wl_argument; 4] = unsafe { ::std::mem::zeroed() };
                    _args_array[0].o = surface.as_ref().c_ptr() as *mut _;
                    _args_array[1].o = output.as_ref().c_ptr() as *mut _;
                    _args_array[2].i = framerate;
                    _args_array[3].o = feedback.as_ref().c_ptr() as *mut _;
                    f(2, &mut _args_array)
                },
            }
        }
    }
    pub enum Event {
        ///advertises a capability of the compositor
        ///
        ///Advertises a single capability of the compositor.
        ///
        ///When the wl_fullscreen_shell interface is bound, this event is
        /// emitted once for each capability advertised.  Valid
        /// capabilities are given by the wl_fullscreen_shell.capability
        /// enum.  If clients want to take advantage of any of these
        /// capabilities, they should use a wl_display.sync request
        /// immediately after binding to ensure that they receive all
        /// the capability events.
        Capability { capability: u32 },
        #[doc(hidden)]
        __nonexhaustive,
    }
    impl super::MessageGroup for Event {
        type Map = super::ProxyMap;

        const MESSAGES: &'static [super::MessageDesc] = &[super::MessageDesc {
            name: "capability",
            since: 1,
            signature: &[super::ArgumentType::Uint],
        }];

        fn is_destructor(&self) -> bool {
            match *self {
                Event::__nonexhaustive => unreachable!(),
                _ => false,
            }
        }

        fn opcode(&self) -> u16 {
            match *self {
                Event::__nonexhaustive => unreachable!(),
                Event::Capability { .. } => 0,
            }
        }

        fn since(&self) -> u32 {
            match *self {
                Event::__nonexhaustive => unreachable!(),
                Event::Capability { .. } => 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::Capability {
                        capability: {
                            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::Capability {
                        capability: _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 ZwpFullscreenShellV1(Proxy<ZwpFullscreenShellV1>);
    impl AsRef<Proxy<ZwpFullscreenShellV1>> for ZwpFullscreenShellV1 {
        #[inline]
        fn as_ref(&self) -> &Proxy<Self> { &self.0 }
    }
    impl From<Proxy<ZwpFullscreenShellV1>> for ZwpFullscreenShellV1 {
        #[inline]
        fn from(value: Proxy<Self>) -> Self { ZwpFullscreenShellV1(value) }
    }
    impl From<ZwpFullscreenShellV1> for Proxy<ZwpFullscreenShellV1> {
        #[inline]
        fn from(value: ZwpFullscreenShellV1) -> Self { value.0 }
    }
    impl Interface for ZwpFullscreenShellV1 {
        type Event = Event;
        type Request = Request;

        const NAME: &'static str = "zwp_fullscreen_shell_v1";
        const VERSION: u32 = 1;

        fn c_interface() -> *const wl_interface { unsafe { &zwp_fullscreen_shell_v1_interface } }
    }
    impl ZwpFullscreenShellV1 {
        ///release the wl_fullscreen_shell interface
        ///
        ///Release the binding from the wl_fullscreen_shell interface.
        ///
        ///This destroys the server-side object and frees this binding.  If
        ///the client binds to wl_fullscreen_shell multiple times, it may wish
        ///to free some of those bindings.
        ///
        ///This is a destructor, you cannot send requests to this object any
        /// longer once this method is called.
        pub fn release(&self) -> () {
            let msg = Request::Release;
            self.0.send(msg);
        }

        ///present surface for display
        ///
        ///Present a surface on the given output.
        ///
        ///If the output is null, the compositor will present the surface on
        ///whatever display (or displays) it thinks best.  In particular, this
        ///may replace any or all surfaces currently presented so it should
        ///not be used in combination with placing surfaces on specific
        ///outputs.
        ///
        ///The method parameter is a hint to the compositor for how the surface
        ///is to be presented.  In particular, it tells the compositor how to
        ///handle a size mismatch between the presented surface and the
        ///output.  The compositor is free to ignore this parameter.
        ///
        ///The "zoom", "zoom_crop", and "stretch" methods imply a scaling
        ///operation on the surface.  This will override any kind of output
        ///scaling, so the buffer_scale property of the surface is effectively
        ///ignored.
        pub fn present_surface(
            &self,
            surface: Option<&super::wl_surface::WlSurface>,
            method: u32,
            output: Option<&super::wl_output::WlOutput>,
        ) -> () {
            let msg = Request::PresentSurface {
                surface: surface.map(|o| o.clone()),
                method,
                output: output.map(|o| o.clone()),
            };
            self.0.send(msg);
        }

        ///present surface for display at a particular mode
        ///
        ///Presents a surface on the given output for a particular mode.
        ///
        ///If the current size of the output differs from that of the surface,
        ///the compositor will attempt to change the size of the output to
        ///match the surface.  The result of the mode-switch operation will be
        ///returned via the provided wl_fullscreen_shell_mode_feedback object.
        ///
        ///If the current output mode matches the one requested or if the
        ///compositor successfully switches the mode to match the surface,
        ///then the mode_successful event will be sent and the output will
        ///contain the contents of the given surface.  If the compositor
        ///cannot match the output size to the surface size, the mode_failed
        ///will be sent and the output will contain the contents of the
        ///previously presented surface (if any).  If another surface is
        ///presented on the given output before either of these has a chance
        ///to happen, the present_cancelled event will be sent.
        ///
        ///Due to race conditions and other issues unknown to the client, no
        ///mode-switch operation is guaranteed to succeed.  However, if the
        ///mode is one advertised by wl_output.mode or if the compositor
        ///advertises the ARBITRARY_MODES capability, then the client should
        ///expect that the mode-switch operation will usually succeed.
        ///
        ///If the size of the presented surface changes, the resulting output
        ///is undefined.  The compositor may attempt to change the output mode
        ///to compensate.  However, there is no guarantee that a suitable mode
        ///will be found and the client has no way to be notified of success
        ///or failure.
        ///
        ///The framerate parameter specifies the desired framerate for the
        ///output in mHz.  The compositor is free to ignore this parameter.  A
        ///value of 0 indicates that the client has no preference.
        ///
        ///If the value of wl_output.scale differs from
        /// wl_surface.buffer_scale, then the compositor may choose a
        /// mode that matches either the buffer size or the surface
        /// size.  In either case, the surface will fill the output.pub fn present_surface_for_mode < F > ( & self , surface : & super :: wl_surface :: WlSurface , output : & super :: wl_output :: WlOutput , framerate : i32 , implementor : F ) -> Result < super :: zwp_fullscreen_shell_mode_feedback_v1 :: ZwpFullscreenShellModeFeedbackV1 , ( ) > where F : FnOnce ( NewProxy < super :: zwp_fullscreen_shell_mode_feedback_v1 :: ZwpFullscreenShellModeFeedbackV1 > , ) -> super :: zwp_fullscreen_shell_mode_feedback_v1 :: ZwpFullscreenShellModeFeedbackV1{
            let msg = Request::PresentSurfaceForMode {
                surface: surface.clone(),
                output: output.clone(),
                framerate,
                feedback: self.0.child_placeholder(),
            };
            self.0.send_constructor(msg, implementor, None)
        }
    }
    /// An interface for handling events.
    pub trait EventHandler {
        ///advertises a capability of the compositor
        ///
        ///Advertises a single capability of the compositor.
        ///
        ///When the wl_fullscreen_shell interface is bound, this event is
        /// emitted once for each capability advertised.  Valid
        /// capabilities are given by the wl_fullscreen_shell.capability
        /// enum.  If clients want to take advantage of any of these
        /// capabilities, they should use a wl_display.sync request
        /// immediately after binding to ensure that they receive all
        /// the capability events.
        fn capability(&mut self, object: ZwpFullscreenShellV1, capability: u32) {}
    }
    impl<T: EventHandler> HandledBy<T> for ZwpFullscreenShellV1 {
        #[inline]
        fn handle(__handler: &mut T, event: Event, __object: Self) {
            match event {
                Event::Capability { capability } => __handler.capability(__object, capability),
                Event::__nonexhaustive => unreachable!(),
            }
        }
    }
    /// The minimal object version supporting this request
    pub const REQ_RELEASE_SINCE: u32 = 1u32;
    /// The minimal object version supporting this request
    pub const REQ_PRESENT_SURFACE_SINCE: u32 = 1u32;
    /// The minimal object version supporting this request
    pub const REQ_PRESENT_SURFACE_FOR_MODE_SINCE: u32 = 1u32;
    /// The minimal object version supporting this event
    pub const EVT_CAPABILITY_SINCE: u32 = 1u32;
    static mut zwp_fullscreen_shell_v1_requests_present_surface_types: [*const wl_interface; 3] = [
        unsafe { &super::wl_surface::wl_surface_interface as *const wl_interface },
        NULLPTR as *const wl_interface,
        unsafe { &super::wl_output::wl_output_interface as *const wl_interface },
    ];
    static mut zwp_fullscreen_shell_v1_requests_present_surface_for_mode_types:
        [*const wl_interface; 4] = [
        unsafe { &super::wl_surface::wl_surface_interface as *const wl_interface },
        unsafe { &super::wl_output::wl_output_interface as *const wl_interface },
        NULLPTR as *const wl_interface,
        unsafe {
            & super :: zwp_fullscreen_shell_mode_feedback_v1 :: zwp_fullscreen_shell_mode_feedback_v1_interface as * const wl_interface
        },
    ];
    /// C-representation of the messages of this interface, for interop
    pub static mut zwp_fullscreen_shell_v1_requests: [wl_message; 3] = [
        wl_message {
            name: b"release\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"present_surface\0" as *const u8 as *const c_char,
            signature: b"?ou?o\0" as *const u8 as *const c_char,
            types: unsafe { &zwp_fullscreen_shell_v1_requests_present_surface_types as *const _ },
        },
        wl_message {
            name: b"present_surface_for_mode\0" as *const u8 as *const c_char,
            signature: b"ooin\0" as *const u8 as *const c_char,
            types: unsafe {
                &zwp_fullscreen_shell_v1_requests_present_surface_for_mode_types as *const _
            },
        },
    ];
    /// C-representation of the messages of this interface, for interop
    pub static mut zwp_fullscreen_shell_v1_events: [wl_message; 1] = [wl_message {
        name: b"capability\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 _ },
    }];
    /// C representation of this interface, for interop
    pub static mut zwp_fullscreen_shell_v1_interface: wl_interface = wl_interface {
        name: b"zwp_fullscreen_shell_v1\0" as *const u8 as *const c_char,
        version: 1,
        request_count: 3,
        requests: unsafe { &zwp_fullscreen_shell_v1_requests as *const _ },
        event_count: 1,
        events: unsafe { &zwp_fullscreen_shell_v1_events as *const _ },
    };
}
pub mod zwp_fullscreen_shell_mode_feedback_v1 {
    use super::{
        sys::{
            client::*,
            common::{wl_argument, wl_array, wl_interface, wl_message},
        },
        types_null, AnonymousObject, Argument, ArgumentType, HandledBy, Interface, Message,
        MessageDesc, MessageGroup, NewProxy, Object, ObjectMetadata, Proxy, NULLPTR,
    };
    use std::os::raw::c_char;
    pub enum Request {
        #[doc(hidden)]
        __nonexhaustive,
    }
    impl super::MessageGroup for Request {
        type Map = super::ProxyMap;

        const MESSAGES: &'static [super::MessageDesc] = &[];

        fn is_destructor(&self) -> bool {
            match *self {
                Request::__nonexhaustive => unreachable!(),
            }
        }

        fn opcode(&self) -> u16 {
            match *self {
                Request::__nonexhaustive => unreachable!(),
            }
        }

        fn since(&self) -> u32 {
            match *self {
                Request::__nonexhaustive => unreachable!(),
            }
        }

        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, ()> {
            panic!("Request::from_raw can not be used Client-side.")
        }

        fn into_raw(self, sender_id: u32) -> Message {
            match self {
                Request::__nonexhaustive => unreachable!(),
            }
        }

        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::__nonexhaustive => unreachable!(),
            }
        }
    }
    pub enum Event {
        ///mode switch succeeded
        ///
        ///This event indicates that the attempted mode switch operation was
        ///successful.  A surface of the size requested in the mode switch
        ///will fill the output without scaling.
        ///
        ///Upon receiving this event, the client should destroy the
        ///wl_fullscreen_shell_mode_feedback object.
        ModeSuccessful,
        ///mode switch failed
        ///
        ///This event indicates that the attempted mode switch operation
        ///failed.  This may be because the requested output mode is not
        ///possible or it may mean that the compositor does not want to allow
        /// it.
        ///
        ///Upon receiving this event, the client should destroy the
        ///wl_fullscreen_shell_mode_feedback object.
        ModeFailed,
        ///mode switch cancelled
        ///
        ///This event indicates that the attempted mode switch operation was
        ///cancelled.  Most likely this is because the client requested a
        ///second mode switch before the first one completed.
        ///
        ///Upon receiving this event, the client should destroy the
        ///wl_fullscreen_shell_mode_feedback object.
        PresentCancelled,
        #[doc(hidden)]
        __nonexhaustive,
    }
    impl super::MessageGroup for Event {
        type Map = super::ProxyMap;

        const MESSAGES: &'static [super::MessageDesc] = &[
            super::MessageDesc {
                name: "mode_successful",
                since: 1,
                signature: &[],
            },
            super::MessageDesc {
                name: "mode_failed",
                since: 1,
                signature: &[],
            },
            super::MessageDesc {
                name: "present_cancelled",
                since: 1,
                signature: &[],
            },
        ];

        fn is_destructor(&self) -> bool {
            match *self {
                Event::__nonexhaustive => unreachable!(),
                _ => false,
            }
        }

        fn opcode(&self) -> u16 {
            match *self {
                Event::__nonexhaustive => unreachable!(),
                Event::ModeSuccessful => 0,
                Event::ModeFailed => 1,
                Event::PresentCancelled => 2,
            }
        }

        fn since(&self) -> u32 {
            match *self {
                Event::__nonexhaustive => unreachable!(),
                Event::ModeSuccessful => 1,
                Event::ModeFailed => 1,
                Event::PresentCancelled => 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 => Ok(Event::ModeSuccessful),
                1 => Ok(Event::ModeFailed),
                2 => Ok(Event::PresentCancelled),
                _ => 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 => Ok(Event::ModeSuccessful),
                1 => Ok(Event::ModeFailed),
                2 => Ok(Event::PresentCancelled),
                _ => 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 ZwpFullscreenShellModeFeedbackV1(Proxy<ZwpFullscreenShellModeFeedbackV1>);
    impl AsRef<Proxy<ZwpFullscreenShellModeFeedbackV1>> for ZwpFullscreenShellModeFeedbackV1 {
        #[inline]
        fn as_ref(&self) -> &Proxy<Self> { &self.0 }
    }
    impl From<Proxy<ZwpFullscreenShellModeFeedbackV1>> for ZwpFullscreenShellModeFeedbackV1 {
        #[inline]
        fn from(value: Proxy<Self>) -> Self { ZwpFullscreenShellModeFeedbackV1(value) }
    }
    impl From<ZwpFullscreenShellModeFeedbackV1> for Proxy<ZwpFullscreenShellModeFeedbackV1> {
        #[inline]
        fn from(value: ZwpFullscreenShellModeFeedbackV1) -> Self { value.0 }
    }
    impl Interface for ZwpFullscreenShellModeFeedbackV1 {
        type Event = Event;
        type Request = Request;

        const NAME: &'static str = "zwp_fullscreen_shell_mode_feedback_v1";
        const VERSION: u32 = 1;

        fn c_interface() -> *const wl_interface {
            unsafe { &zwp_fullscreen_shell_mode_feedback_v1_interface }
        }
    }
    impl ZwpFullscreenShellModeFeedbackV1 {}
    /// An interface for handling events.
    pub trait EventHandler {
        ///mode switch succeeded
        ///
        ///This event indicates that the attempted mode switch operation was
        ///successful.  A surface of the size requested in the mode switch
        ///will fill the output without scaling.
        ///
        ///Upon receiving this event, the client should destroy the
        ///wl_fullscreen_shell_mode_feedback object.
        fn mode_successful(&mut self, object: ZwpFullscreenShellModeFeedbackV1) {}
        ///mode switch failed
        ///
        ///This event indicates that the attempted mode switch operation
        ///failed.  This may be because the requested output mode is not
        ///possible or it may mean that the compositor does not want to allow
        /// it.
        ///
        ///Upon receiving this event, the client should destroy the
        ///wl_fullscreen_shell_mode_feedback object.
        fn mode_failed(&mut self, object: ZwpFullscreenShellModeFeedbackV1) {}
        ///mode switch cancelled
        ///
        ///This event indicates that the attempted mode switch operation was
        ///cancelled.  Most likely this is because the client requested a
        ///second mode switch before the first one completed.
        ///
        ///Upon receiving this event, the client should destroy the
        ///wl_fullscreen_shell_mode_feedback object.
        fn present_cancelled(&mut self, object: ZwpFullscreenShellModeFeedbackV1) {}
    }
    impl<T: EventHandler> HandledBy<T> for ZwpFullscreenShellModeFeedbackV1 {
        #[inline]
        fn handle(__handler: &mut T, event: Event, __object: Self) {
            match event {
                Event::ModeSuccessful {} => __handler.mode_successful(__object),
                Event::ModeFailed {} => __handler.mode_failed(__object),
                Event::PresentCancelled {} => __handler.present_cancelled(__object),
                Event::__nonexhaustive => unreachable!(),
            }
        }
    }
    /// The minimal object version supporting this event
    pub const EVT_MODE_SUCCESSFUL_SINCE: u32 = 1u32;
    /// The minimal object version supporting this event
    pub const EVT_MODE_FAILED_SINCE: u32 = 1u32;
    /// The minimal object version supporting this event
    pub const EVT_PRESENT_CANCELLED_SINCE: u32 = 1u32;
    /// C-representation of the messages of this interface, for interop
    pub static mut zwp_fullscreen_shell_mode_feedback_v1_events: [wl_message; 3] = [
        wl_message {
            name: b"mode_successful\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"mode_failed\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"present_cancelled\0" as *const u8 as *const c_char,
            signature: b"\0" as *const u8 as *const c_char,
            types: unsafe { &types_null as *const _ },
        },
    ];
    /// C representation of this interface, for interop
    pub static mut zwp_fullscreen_shell_mode_feedback_v1_interface: wl_interface = wl_interface {
        name: b"zwp_fullscreen_shell_mode_feedback_v1\0" as *const u8 as *const c_char,
        version: 1,
        request_count: 0,
        requests: NULLPTR as *const wl_message,
        event_count: 3,
        events: unsafe { &zwp_fullscreen_shell_mode_feedback_v1_events as *const _ },
    };
}

The problem is at /// size. In either case, the surface will fill the output.pub fn present_surface_for_mode < F > ( & self , surface : & super :: wl_surface :: WlSurface , output : & super :: wl_output :: WlOutput , framerate : i32 , implementor : F ) -> Result < super :: zwp_fullscreen_shell_mode_feedback_v1 :: ZwpFullscreenShellModeFeedbackV1 , ( ) > where F : FnOnce ( NewProxy < super :: zwp_fullscreen_shell_mode_feedback_v1 :: ZwpFullscreenShellModeFeedbackV1 > , ) -> super :: zwp_fullscreen_shell_mode_feedback_v1 :: ZwpFullscreenShellModeFeedbackV1{. There should be a newline before pub fn.

@bjorn3
Copy link
Contributor Author

bjorn3 commented Feb 3, 2020

The same problem happened with two other files.

@elinorbgr
Copy link
Member

What is the build context which triggered this? I can't seem to reproduce it...

@bjorn3
Copy link
Contributor Author

bjorn3 commented Feb 3, 2020

I tried to compile veloren commit 5b46587c2d9e3aa8ebf5e22bfa84399b0303fcbe on Debian Stretch.

@elinorbgr
Copy link
Member

Which cargo/rustc versions does that correspond to?

@Friz64
Copy link

Friz64 commented Feb 3, 2020

i can reproduce it by installing veloren-git from the aur; the rust-toolchain file specifies nightly-2020-01-18

@elinorbgr
Copy link
Member

There is something very fishy going on here.

Veloren depends on two different versions of wayland-client, 0.21.13 and 0.23.6. This should not be a big deal, but both of these versions use quote for the code generation part. Meaning that the generated code should only generate doc comments a #[doc = "...."], not /// .....

This is not normal at all that the code generated in veloren build contains these /// .... comments.

@elinorbgr
Copy link
Member

This is a rustfmt bug: rust-lang/rustfmt#3988

Disable normalize_doc_attributes = true from veloren's .rustfmt.toml and it'll disapear.

@Friz64
Copy link

Friz64 commented Feb 3, 2020

Opened a bug report in the veloren GitLab: https://gitlab.com/veloren/veloren/issues/461

@bjorn3
Copy link
Contributor Author

bjorn3 commented Feb 3, 2020

Thanks for investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants