surfman_chains_api/
lib.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5/// The consumer's view of a swap chain
6pub trait SwapChainAPI: 'static + Clone + Send {
7    type Surface;
8
9    /// Take the current front buffer.
10    fn take_surface(&self) -> Option<Self::Surface>;
11
12    /// Recycle the current front buffer.
13    fn recycle_surface(&self, surface: Self::Surface);
14}
15
16/// The consumer's view of a collection of swap chains
17pub trait SwapChainsAPI<SwapChainID>: 'static + Clone + Send {
18    type Surface;
19    type SwapChain: SwapChainAPI<Surface = Self::Surface>;
20
21    /// Get a swap chain
22    fn get(&self, id: SwapChainID) -> Option<Self::SwapChain>;
23}