Struct wayland_client::Proxy
source · pub struct Proxy<I: Interface> { /* private fields */ }
Expand description
An handle to a wayland proxy
This represents a wayland object instantiated in your client session. Several handles to the same object can exist at a given time, and cloning them won’t create a new protocol object, only clone the handle. The lifetime of the protocol object is not tied to the lifetime of these handles, but rather to sending or receiving destroying messages.
These handles are notably used to send requests to the server. To do
you need to import the associated RequestsTrait
trait from the module
of this interface.
Implementations
sourceimpl<I: Interface> Proxy<I>
impl<I: Interface> Proxy<I>
sourcepub fn send(&self, msg: I::Request)
pub fn send(&self, msg: I::Request)
Send a request through this object
Warning: This method is mostly intended to be used by code generated
by wayland-scanner
, and you should probably never need to use it directly,
but rather use the appropriate RequestsTrait
for your proxy.
This is the generic method to send requests.
If your request needs to create an object, use send_constructor
.
sourcepub fn send_constructor<J, F>(
&self,
msg: I::Request,
implementor: F,
version: Option<u32>
) -> Result<Proxy<J>, ()>where
J: Interface,
F: FnOnce(NewProxy<J>) -> Proxy<J>,
pub fn send_constructor<J, F>(
&self,
msg: I::Request,
implementor: F,
version: Option<u32>
) -> Result<Proxy<J>, ()>where
J: Interface,
F: FnOnce(NewProxy<J>) -> Proxy<J>,
Send a request creating an object through this object
Warning: This method is mostly intended to be used by code generated
by wayland-scanner
, and you should probably never need to use it directly,
but rather use the appropriate RequestsTrait
for your proxy.
This is the generic method to send requests that create objects
The slot in the message corresponding with the newly created object must have
been filled by a placeholder object (see child_placeholder
).
sourcepub fn is_alive(&self) -> bool
pub fn is_alive(&self) -> bool
Check if the object associated with this proxy is still alive
Will return false
if the object has been destroyed.
If the object is not managed by this library, this will always
returns true
.
sourcepub fn version(&self) -> u32
pub fn version(&self) -> u32
Retrieve the interface version of this wayland object instance
Returns 0 on dead objects
sourcepub fn user_data<UD: 'static>(&self) -> Option<&UD>
pub fn user_data<UD: 'static>(&self) -> Option<&UD>
Access the arbitrary payload associated to this object
You need to specify the expected type of this payload, and this
function will return None
if either the types don’t match or
you are attempting to access a non Send + Sync
user data from the
wrong thread.
This value is associated to the Proxy when you implement it, and you
cannot access it mutably afterwards. If you need interior mutability,
you are responsible for using a Mutex
or similar type to achieve it.
sourcepub fn equals(&self, other: &Proxy<I>) -> bool
pub fn equals(&self, other: &Proxy<I>) -> bool
Check if the other proxy refers to the same underlying wayland object
sourcepub fn child<C: Interface>(&self) -> NewProxy<C>
pub fn child<C: Interface>(&self) -> NewProxy<C>
Create a new child object
Warning: This method is mostly intended to be used by code generated
by wayland-scanner
, and you should probably never need to use it directly,
but rather use the appropriate RequestsTrait
for your proxy.
This creates a new wayland object, considered as a child of this object. It will notably inherit its interface version.
The created object should immediately be implemented and sent in a request to the server, to keep the object list properly synchronized. Failure to do so will likely cause a protocol error.
sourcepub fn anonymize(&self) -> Proxy<AnonymousObject>
pub fn anonymize(&self) -> Proxy<AnonymousObject>
Creates a handle of this proxy with its actual type erased
sourcepub fn make_wrapper(&self, queue: &QueueToken) -> Result<Proxy<I>, ()>
pub fn make_wrapper(&self, queue: &QueueToken) -> Result<Proxy<I>, ()>
Create a wrapper for this object for queue management
As assigning a proxy to an event queue can be a racy operation in contexts involving multiple thread, this provides a facility to do this safely.
The wrapper object created behaves like a regular Proxy
, except that
all objects created as the result of its requests will be assigned to
the queue associated to the provided token, rather than the queue of
their parent. This does not change the queue of the proxy itself.
sourcepub fn child_placeholder<J: Interface>(&self) -> Proxy<J>
pub fn child_placeholder<J: Interface>(&self) -> Proxy<J>
Create a placeholder object, to be used with send_constructor
Warning: This method is mostly intended to be used by code generated
by wayland-scanner
, and you should probably never need to use it directly,
but rather use the appropriate RequestsTrait
for your proxy.
Trait Implementations
sourceimpl<I: Interface> PartialEq<Proxy<I>> for Proxy<I>
impl<I: Interface> PartialEq<Proxy<I>> for Proxy<I>
sourceimpl RequestsTrait for Proxy<WlCompositor>
impl RequestsTrait for Proxy<WlCompositor>
sourceimpl RequestsTrait for Proxy<WlDataDevice>
impl RequestsTrait for Proxy<WlDataDevice>
sourcefn start_drag(
&self,
source: Option<&Proxy<WlDataSource>>,
origin: &Proxy<WlSurface>,
icon: Option<&Proxy<WlSurface>>,
serial: u32
)
fn start_drag(
&self,
source: Option<&Proxy<WlDataSource>>,
origin: &Proxy<WlSurface>,
icon: Option<&Proxy<WlSurface>>,
serial: u32
)
sourcefn set_selection(&self, source: Option<&Proxy<WlDataSource>>, serial: u32)
fn set_selection(&self, source: Option<&Proxy<WlDataSource>>, serial: u32)
sourceimpl RequestsTrait for Proxy<WlDataDeviceManager>
impl RequestsTrait for Proxy<WlDataDeviceManager>
sourcefn create_data_source<F>(
&self,
implementor: F
) -> Result<Proxy<WlDataSource>, ()>where
F: FnOnce(NewProxy<WlDataSource>) -> Proxy<WlDataSource>,
fn create_data_source<F>(
&self,
implementor: F
) -> Result<Proxy<WlDataSource>, ()>where
F: FnOnce(NewProxy<WlDataSource>) -> Proxy<WlDataSource>,
sourcefn get_data_device<F>(
&self,
seat: &Proxy<WlSeat>,
implementor: F
) -> Result<Proxy<WlDataDevice>, ()>where
F: FnOnce(NewProxy<WlDataDevice>) -> Proxy<WlDataDevice>,
fn get_data_device<F>(
&self,
seat: &Proxy<WlSeat>,
implementor: F
) -> Result<Proxy<WlDataDevice>, ()>where
F: FnOnce(NewProxy<WlDataDevice>) -> Proxy<WlDataDevice>,
sourceimpl RequestsTrait for Proxy<WlDataOffer>
impl RequestsTrait for Proxy<WlDataOffer>
sourceimpl RequestsTrait for Proxy<WlDataSource>
impl RequestsTrait for Proxy<WlDataSource>
sourceimpl RequestsTrait for Proxy<WlDisplay>
impl RequestsTrait for Proxy<WlDisplay>
sourcefn sync<F>(&self, implementor: F) -> Result<Proxy<WlCallback>, ()>where
F: FnOnce(NewProxy<WlCallback>) -> Proxy<WlCallback>,
fn sync<F>(&self, implementor: F) -> Result<Proxy<WlCallback>, ()>where
F: FnOnce(NewProxy<WlCallback>) -> Proxy<WlCallback>,
sourcefn get_registry<F>(&self, implementor: F) -> Result<Proxy<WlRegistry>, ()>where
F: FnOnce(NewProxy<WlRegistry>) -> Proxy<WlRegistry>,
fn get_registry<F>(&self, implementor: F) -> Result<Proxy<WlRegistry>, ()>where
F: FnOnce(NewProxy<WlRegistry>) -> Proxy<WlRegistry>,
sourceimpl RequestsTrait for Proxy<WlKeyboard>
impl RequestsTrait for Proxy<WlKeyboard>
sourceimpl RequestsTrait for Proxy<WlOutput>
impl RequestsTrait for Proxy<WlOutput>
sourceimpl RequestsTrait for Proxy<WlPointer>
impl RequestsTrait for Proxy<WlPointer>
sourceimpl RequestsTrait for Proxy<WlRegion>
impl RequestsTrait for Proxy<WlRegion>
sourceimpl RequestsTrait for Proxy<WlRegistry>
impl RequestsTrait for Proxy<WlRegistry>
sourceimpl RequestsTrait for Proxy<WlSeat>
impl RequestsTrait for Proxy<WlSeat>
sourcefn get_pointer<F>(&self, implementor: F) -> Result<Proxy<WlPointer>, ()>where
F: FnOnce(NewProxy<WlPointer>) -> Proxy<WlPointer>,
fn get_pointer<F>(&self, implementor: F) -> Result<Proxy<WlPointer>, ()>where
F: FnOnce(NewProxy<WlPointer>) -> Proxy<WlPointer>,
sourcefn get_keyboard<F>(&self, implementor: F) -> Result<Proxy<WlKeyboard>, ()>where
F: FnOnce(NewProxy<WlKeyboard>) -> Proxy<WlKeyboard>,
fn get_keyboard<F>(&self, implementor: F) -> Result<Proxy<WlKeyboard>, ()>where
F: FnOnce(NewProxy<WlKeyboard>) -> Proxy<WlKeyboard>,
sourceimpl RequestsTrait for Proxy<WlShell>
impl RequestsTrait for Proxy<WlShell>
sourcefn get_shell_surface<F>(
&self,
surface: &Proxy<WlSurface>,
implementor: F
) -> Result<Proxy<WlShellSurface>, ()>where
F: FnOnce(NewProxy<WlShellSurface>) -> Proxy<WlShellSurface>,
fn get_shell_surface<F>(
&self,
surface: &Proxy<WlSurface>,
implementor: F
) -> Result<Proxy<WlShellSurface>, ()>where
F: FnOnce(NewProxy<WlShellSurface>) -> Proxy<WlShellSurface>,
sourceimpl RequestsTrait for Proxy<WlShellSurface>
impl RequestsTrait for Proxy<WlShellSurface>
sourcefn resize(&self, seat: &Proxy<WlSeat>, serial: u32, edges: Resize)
fn resize(&self, seat: &Proxy<WlSeat>, serial: u32, edges: Resize)
sourcefn set_toplevel(&self)
fn set_toplevel(&self)
sourcefn set_transient(&self, parent: &Proxy<WlSurface>, x: i32, y: i32, flags: Transient)
fn set_transient(&self, parent: &Proxy<WlSurface>, x: i32, y: i32, flags: Transient)
sourcefn set_fullscreen(
&self,
method: FullscreenMethod,
framerate: u32,
output: Option<&Proxy<WlOutput>>
)
fn set_fullscreen(
&self,
method: FullscreenMethod,
framerate: u32,
output: Option<&Proxy<WlOutput>>
)
sourcefn set_popup(
&self,
seat: &Proxy<WlSeat>,
serial: u32,
parent: &Proxy<WlSurface>,
x: i32,
y: i32,
flags: Transient
)
fn set_popup(
&self,
seat: &Proxy<WlSeat>,
serial: u32,
parent: &Proxy<WlSurface>,
x: i32,
y: i32,
flags: Transient
)
sourceimpl RequestsTrait for Proxy<WlShm>
impl RequestsTrait for Proxy<WlShm>
sourceimpl RequestsTrait for Proxy<WlShmPool>
impl RequestsTrait for Proxy<WlShmPool>
sourceimpl RequestsTrait for Proxy<WlSubcompositor>
impl RequestsTrait for Proxy<WlSubcompositor>
sourcefn get_subsurface<F>(
&self,
surface: &Proxy<WlSurface>,
parent: &Proxy<WlSurface>,
implementor: F
) -> Result<Proxy<WlSubsurface>, ()>where
F: FnOnce(NewProxy<WlSubsurface>) -> Proxy<WlSubsurface>,
fn get_subsurface<F>(
&self,
surface: &Proxy<WlSurface>,
parent: &Proxy<WlSurface>,
implementor: F
) -> Result<Proxy<WlSubsurface>, ()>where
F: FnOnce(NewProxy<WlSubsurface>) -> Proxy<WlSubsurface>,
sourceimpl RequestsTrait for Proxy<WlSubsurface>
impl RequestsTrait for Proxy<WlSubsurface>
sourcefn set_position(&self, x: i32, y: i32)
fn set_position(&self, x: i32, y: i32)
sourcefn place_above(&self, sibling: &Proxy<WlSurface>)
fn place_above(&self, sibling: &Proxy<WlSurface>)
sourcefn place_below(&self, sibling: &Proxy<WlSurface>)
fn place_below(&self, sibling: &Proxy<WlSurface>)
sourcefn set_desync(&self)
fn set_desync(&self)
sourceimpl RequestsTrait for Proxy<WlSurface>
impl RequestsTrait for Proxy<WlSurface>
sourcefn attach(&self, buffer: Option<&Proxy<WlBuffer>>, x: i32, y: i32)
fn attach(&self, buffer: Option<&Proxy<WlBuffer>>, x: i32, y: i32)
sourcefn damage(&self, x: i32, y: i32, width: i32, height: i32)
fn damage(&self, x: i32, y: i32, width: i32, height: i32)
sourcefn frame<F>(&self, implementor: F) -> Result<Proxy<WlCallback>, ()>where
F: FnOnce(NewProxy<WlCallback>) -> Proxy<WlCallback>,
fn frame<F>(&self, implementor: F) -> Result<Proxy<WlCallback>, ()>where
F: FnOnce(NewProxy<WlCallback>) -> Proxy<WlCallback>,
sourcefn set_buffer_transform(&self, transform: Transform)
fn set_buffer_transform(&self, transform: Transform)
sourcefn set_buffer_scale(&self, scale: i32)
fn set_buffer_scale(&self, scale: i32)
sourceimpl RequestsTrait for Proxy<WlTouch>
impl RequestsTrait for Proxy<WlTouch>
impl<I: Interface> Eq for Proxy<I>
impl RequestsTrait for Proxy<WlCallback>
Auto Trait Implementations
impl<I> !RefUnwindSafe for Proxy<I>
impl<I> Send for Proxy<I>where
I: Sync,
impl<I> Sync for Proxy<I>where
I: Sync,
impl<I> Unpin for Proxy<I>
impl<I> !UnwindSafe for Proxy<I>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read moresourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more