libcosmic/cosmic/cctk/sctk/globals/trait.ProvidesBoundGlobal.html
2026-04-18 20:11:25 +00:00

36 lines
No EOL
19 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A trait implemented by types that provide access to capability globals."><title>ProvidesBoundGlobal in cosmic::cctk::sctk::globals - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Provides<wbr>Bound<wbr>Global</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.bound_global" title="bound_global">bound_global</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.with_min_version" title="with_min_version">with_min_version</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>globals</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../index.html">cosmic</a>::<wbr><a href="../../index.html">cctk</a>::<wbr><a href="../index.html">sctk</a>::<wbr><a href="index.html">globals</a></div><h1>Trait <span class="trait">ProvidesBoundGlobal</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait ProvidesBoundGlobal&lt;I, const API_COMPAT_VERSION: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>&gt;<div class="where">where
I: <a class="trait" href="../reexports/client/trait.Proxy.html" title="trait cosmic::cctk::sctk::reexports::client::Proxy">Proxy</a>,</div>{
// Required method
fn <a href="#tymethod.bound_global" class="fn">bound_global</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;I, <a class="enum" href="../error/enum.GlobalError.html" title="enum cosmic::cctk::sctk::error::GlobalError">GlobalError</a>&gt;;
// Provided method
fn <a href="#method.with_min_version" class="fn">with_min_version</a>(&amp;self, version: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;I, <a class="enum" href="../error/enum.GlobalError.html" title="enum cosmic::cctk::sctk::error::GlobalError">GlobalError</a>&gt; { ... }
}</code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A trait implemented by types that provide access to capability globals.</p>
<p>The returned global must be fully compatible with the provided <code>API_COMPAT_VERSION</code> generic
argument. For example:</p>
<ul>
<li>A global that binds to <code>wl_compositor</code> with maximum version 4 could implement
<code>ProvidesBoundGlobal&lt;WlCompositor, 4&gt;</code>, <code>ProvidesBoundGlobal&lt;WlCompositor, 3&gt;</code>,
<code>ProvidesBoundGlobal&lt;WlCompositor, 2&gt;</code>, and <code>ProvidesBoundGlobal&lt;WlCompositor, 1&gt;</code> because
versions 2-4 only add additional requests to the <code>wl_surface</code> API.</li>
<li>A global that binds to <code>wl_compositor</code> with maximum version 5 may only implement
<code>ProvidesBoundGlobal&lt;WlCompositor, 5&gt;</code> because version 5 makes using <code>wl_surface::attach</code> with
a nonzero offset a protocol error. A caller who is only aware of the version 4 API risks
causing these protocol errors if it uses surfaces created by such a global.</li>
</ul>
<p>Changes that cause compatibility breaks include:</p>
<ul>
<li>Adding a new event to the global or to any object created by the global.</li>
<li>Adding a new requirement to an existing request.</li>
</ul>
<p>The resulting global may have a version lower than <code>API_COMPAT_VERSION</code> if, at runtime, the
compositor does not support the new version. Clients should either be prepared to handle
earlier versions of the protocol or use <a href="trait.ProvidesBoundGlobal.html#method.with_min_version" title="method cosmic::cctk::sctk::globals::ProvidesBoundGlobal::with_min_version"><code>ProvidesBoundGlobal::with_min_version</code></a> to produce an
error in this case.</p>
<p>It is permitted to implement <code>ProvidesBoundGlobal</code> for versions that are higher than the
maximum version you bind. When rustc gains the ability to constrain const parameters with
integer bounds (<code>where API_COMPAT_VERSION &gt;= 5</code>), implementations of this trait should be
provided by specifying a lower bound for the compat version in order to avoid requiring version
updates be done in lock-step.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><section id="tymethod.bound_global" class="method"><h4 class="code-header">fn <a href="#tymethod.bound_global" class="fn">bound_global</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;I, <a class="enum" href="../error/enum.GlobalError.html" title="enum cosmic::cctk::sctk::error::GlobalError">GlobalError</a>&gt;</h4></section></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><section id="method.with_min_version" class="method"><h4 class="code-header">fn <a href="#method.with_min_version" class="fn">with_min_version</a>(&amp;self, version: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;I, <a class="enum" href="../error/enum.GlobalError.html" title="enum cosmic::cctk::sctk::error::GlobalError">GlobalError</a>&gt;</h4></section></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ProvidesBoundGlobal%3CWlCompositor,+smithay_client_toolkit::::compositor::%7Bimpl%2313%7D::%7Bconstant%230%7D%3E-for-CompositorState" class="impl"><a href="#impl-ProvidesBoundGlobal%3CWlCompositor,+smithay_client_toolkit::::compositor::%7Bimpl%2313%7D::%7Bconstant%230%7D%3E-for-CompositorState" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/client/protocol/wl_compositor/struct.WlCompositor.html" title="struct cosmic::cctk::sctk::reexports::client::protocol::wl_compositor::WlCompositor">WlCompositor</a>, smithay_client_toolkit::::compositor::{impl#13}::{constant#0}&gt; for <a class="struct" href="../compositor/struct.CompositorState.html" title="struct cosmic::cctk::sctk::compositor::CompositorState">CompositorState</a></h3></section><section id="impl-ProvidesBoundGlobal%3CWlDataDeviceManager,+3%3E-for-DataDeviceManagerState" class="impl"><a href="#impl-ProvidesBoundGlobal%3CWlDataDeviceManager,+3%3E-for-DataDeviceManagerState" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/client/protocol/wl_data_device_manager/struct.WlDataDeviceManager.html" title="struct cosmic::cctk::sctk::reexports::client::protocol::wl_data_device_manager::WlDataDeviceManager">WlDataDeviceManager</a>, 3&gt; for <a class="struct" href="../data_device_manager/struct.DataDeviceManagerState.html" title="struct cosmic::cctk::sctk::data_device_manager::DataDeviceManagerState">DataDeviceManagerState</a></h3></section><section id="impl-ProvidesBoundGlobal%3CWlShm,+1%3E-for-Shm" class="impl"><a href="#impl-ProvidesBoundGlobal%3CWlShm,+1%3E-for-Shm" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/client/protocol/wl_shm/struct.WlShm.html" title="struct cosmic::cctk::sctk::reexports::client::protocol::wl_shm::WlShm">WlShm</a>, 1&gt; for <a class="struct" href="../shm/struct.Shm.html" title="struct cosmic::cctk::sctk::shm::Shm">Shm</a></h3></section><section id="impl-ProvidesBoundGlobal%3CZwpPointerConstraintsV1,+1%3E-for-PointerConstraintsState" class="impl"><a href="#impl-ProvidesBoundGlobal%3CZwpPointerConstraintsV1,+1%3E-for-PointerConstraintsState" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/protocols/wp/pointer_constraints/zv1/client/zwp_pointer_constraints_v1/struct.ZwpPointerConstraintsV1.html" title="struct cosmic::cctk::sctk::reexports::protocols::wp::pointer_constraints::zv1::client::zwp_pointer_constraints_v1::ZwpPointerConstraintsV1">ZwpPointerConstraintsV1</a>, 1&gt; for <a class="struct" href="../seat/pointer_constraints/struct.PointerConstraintsState.html" title="struct cosmic::cctk::sctk::seat::pointer_constraints::PointerConstraintsState">PointerConstraintsState</a></h3></section><section id="impl-ProvidesBoundGlobal%3CXdgActivationV1,+1%3E-for-ActivationState" class="impl"><a href="#impl-ProvidesBoundGlobal%3CXdgActivationV1,+1%3E-for-ActivationState" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/protocols/xdg/activation/v1/client/xdg_activation_v1/struct.XdgActivationV1.html" title="struct cosmic::cctk::sctk::reexports::protocols::xdg::activation::v1::client::xdg_activation_v1::XdgActivationV1">XdgActivationV1</a>, 1&gt; for <a class="struct" href="../activation/struct.ActivationState.html" title="struct cosmic::cctk::sctk::activation::ActivationState">ActivationState</a></h3></section><section id="impl-ProvidesBoundGlobal%3CZxdgDecorationManagerV1,+1%3E-for-XdgShell" class="impl"><a href="#impl-ProvidesBoundGlobal%3CZxdgDecorationManagerV1,+1%3E-for-XdgShell" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/protocols/xdg/decoration/zv1/client/zxdg_decoration_manager_v1/struct.ZxdgDecorationManagerV1.html" title="struct cosmic::cctk::sctk::reexports::protocols::xdg::decoration::zv1::client::zxdg_decoration_manager_v1::ZxdgDecorationManagerV1">ZxdgDecorationManagerV1</a>, 1&gt; for <a class="struct" href="../shell/xdg/struct.XdgShell.html" title="struct cosmic::cctk::sctk::shell::xdg::XdgShell">XdgShell</a></h3></section><section id="impl-ProvidesBoundGlobal%3CXdgWmBase,+5%3E-for-XdgShell" class="impl"><a href="#impl-ProvidesBoundGlobal%3CXdgWmBase,+5%3E-for-XdgShell" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/protocols/xdg/shell/client/xdg_wm_base/struct.XdgWmBase.html" title="struct cosmic::cctk::sctk::reexports::protocols::xdg::shell::client::xdg_wm_base::XdgWmBase">XdgWmBase</a>, 5&gt; for <a class="struct" href="../shell/xdg/struct.XdgShell.html" title="struct cosmic::cctk::sctk::shell::xdg::XdgShell">XdgShell</a></h3></section><section id="impl-ProvidesBoundGlobal%3CXdgWmBase,+smithay_client_toolkit::::shell::xdg::%7Bimpl%2310%7D::%7Bconstant%230%7D%3E-for-XdgShell" class="impl"><a href="#impl-ProvidesBoundGlobal%3CXdgWmBase,+smithay_client_toolkit::::shell::xdg::%7Bimpl%2310%7D::%7Bconstant%230%7D%3E-for-XdgShell" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/protocols/xdg/shell/client/xdg_wm_base/struct.XdgWmBase.html" title="struct cosmic::cctk::sctk::reexports::protocols::xdg::shell::client::xdg_wm_base::XdgWmBase">XdgWmBase</a>, smithay_client_toolkit::::shell::xdg::{impl#10}::{constant#0}&gt; for <a class="struct" href="../shell/xdg/struct.XdgShell.html" title="struct cosmic::cctk::sctk::shell::xdg::XdgShell">XdgShell</a></h3></section><section id="impl-ProvidesBoundGlobal%3CZwlrLayerShellV1,+1%3E-for-LayerShell" class="impl"><a href="#impl-ProvidesBoundGlobal%3CZwlrLayerShellV1,+1%3E-for-LayerShell" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/protocols_wlr/layer_shell/v1/client/zwlr_layer_shell_v1/struct.ZwlrLayerShellV1.html" title="struct cosmic::cctk::sctk::reexports::protocols_wlr::layer_shell::v1::client::zwlr_layer_shell_v1::ZwlrLayerShellV1">ZwlrLayerShellV1</a>, 1&gt; for <a class="struct" href="../shell/wlr_layer/struct.LayerShell.html" title="struct cosmic::cctk::sctk::shell::wlr_layer::LayerShell">LayerShell</a></h3></section><section id="impl-ProvidesBoundGlobal%3CZwlrLayerShellV1,+2%3E-for-LayerShell" class="impl"><a href="#impl-ProvidesBoundGlobal%3CZwlrLayerShellV1,+2%3E-for-LayerShell" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/protocols_wlr/layer_shell/v1/client/zwlr_layer_shell_v1/struct.ZwlrLayerShellV1.html" title="struct cosmic::cctk::sctk::reexports::protocols_wlr::layer_shell::v1::client::zwlr_layer_shell_v1::ZwlrLayerShellV1">ZwlrLayerShellV1</a>, 2&gt; for <a class="struct" href="../shell/wlr_layer/struct.LayerShell.html" title="struct cosmic::cctk::sctk::shell::wlr_layer::LayerShell">LayerShell</a></h3></section><section id="impl-ProvidesBoundGlobal%3CZwlrLayerShellV1,+3%3E-for-LayerShell" class="impl"><a href="#impl-ProvidesBoundGlobal%3CZwlrLayerShellV1,+3%3E-for-LayerShell" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/protocols_wlr/layer_shell/v1/client/zwlr_layer_shell_v1/struct.ZwlrLayerShellV1.html" title="struct cosmic::cctk::sctk::reexports::protocols_wlr::layer_shell::v1::client::zwlr_layer_shell_v1::ZwlrLayerShellV1">ZwlrLayerShellV1</a>, 3&gt; for <a class="struct" href="../shell/wlr_layer/struct.LayerShell.html" title="struct cosmic::cctk::sctk::shell::wlr_layer::LayerShell">LayerShell</a></h3></section><section id="impl-ProvidesBoundGlobal%3CZwlrLayerShellV1,+4%3E-for-LayerShell" class="impl"><a href="#impl-ProvidesBoundGlobal%3CZwlrLayerShellV1,+4%3E-for-LayerShell" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;<a class="struct" href="../reexports/protocols_wlr/layer_shell/v1/client/zwlr_layer_shell_v1/struct.ZwlrLayerShellV1.html" title="struct cosmic::cctk::sctk::reexports::protocols_wlr::layer_shell::v1::client::zwlr_layer_shell_v1::ZwlrLayerShellV1">ZwlrLayerShellV1</a>, 4&gt; for <a class="struct" href="../shell/wlr_layer/struct.LayerShell.html" title="struct cosmic::cctk::sctk::shell::wlr_layer::LayerShell">LayerShell</a></h3></section><section id="impl-ProvidesBoundGlobal%3CI,+MAX_VERSION%3E-for-SimpleGlobal%3CI,+MAX_VERSION%3E" class="impl"><a href="#impl-ProvidesBoundGlobal%3CI,+MAX_VERSION%3E-for-SimpleGlobal%3CI,+MAX_VERSION%3E" class="anchor">§</a><h3 class="code-header">impl&lt;I, const MAX_VERSION: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>&gt; <a class="trait" href="trait.ProvidesBoundGlobal.html" title="trait cosmic::cctk::sctk::globals::ProvidesBoundGlobal">ProvidesBoundGlobal</a>&lt;I, MAX_VERSION&gt; for <a class="struct" href="../registry/struct.SimpleGlobal.html" title="struct cosmic::cctk::sctk::registry::SimpleGlobal">SimpleGlobal</a>&lt;I, MAX_VERSION&gt;<div class="where">where
I: <a class="trait" href="../reexports/client/trait.Proxy.html" title="trait cosmic::cctk::sctk::reexports::client::Proxy">Proxy</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></div><script src="../../../../trait.impl/smithay_client_toolkit/globals/trait.ProvidesBoundGlobal.js" data-ignore-extern-crates="smithay_client_toolkit" async></script></section></div></main></body></html>