Struct surfman::chains::SwapChains
source · pub struct SwapChains<SwapChainID: Eq + Hash, Device: DeviceAPI> {
ids: Arc<Mutex<FnvHashMap<ContextID, FnvHashSet<SwapChainID>>>>,
table: Arc<RwLock<FnvHashMap<SwapChainID, SwapChain<Device>>>>,
}
Expand description
A thread-safe collection of swap chains.
Fields§
§ids: Arc<Mutex<FnvHashMap<ContextID, FnvHashSet<SwapChainID>>>>
§table: Arc<RwLock<FnvHashMap<SwapChainID, SwapChain<Device>>>>
Implementations§
source§impl<SwapChainID, Device> SwapChains<SwapChainID, Device>
impl<SwapChainID, Device> SwapChains<SwapChainID, Device>
sourcepub fn new() -> SwapChains<SwapChainID, Device>
pub fn new() -> SwapChains<SwapChainID, Device>
Create a new collection.
fn ids(&self) -> MutexGuard<'_, FnvHashMap<ContextID, FnvHashSet<SwapChainID>>>
fn table( &self, ) -> RwLockReadGuard<'_, FnvHashMap<SwapChainID, SwapChain<Device>>>
fn table_mut( &self, ) -> RwLockWriteGuard<'_, FnvHashMap<SwapChainID, SwapChain<Device>>>
sourcepub fn create_attached_swap_chain(
&self,
id: SwapChainID,
device: &mut Device,
context: &mut Device::Context,
surface_access: SurfaceAccess,
) -> Result<(), Error>
pub fn create_attached_swap_chain( &self, id: SwapChainID, device: &mut Device, context: &mut Device::Context, surface_access: SurfaceAccess, ) -> Result<(), Error>
Create a new attached swap chain and insert it in the table.
Returns an error if the id
is already in the table.
sourcepub fn create_detached_swap_chain(
&self,
id: SwapChainID,
size: Size2D<i32>,
device: &mut Device,
context: &mut Device::Context,
surface_access: SurfaceAccess,
) -> Result<(), Error>
pub fn create_detached_swap_chain( &self, id: SwapChainID, size: Size2D<i32>, device: &mut Device, context: &mut Device::Context, surface_access: SurfaceAccess, ) -> Result<(), Error>
Create a new dettached swap chain and insert it in the table.
Returns an error if the id
is already in the table.
sourcepub fn destroy(
&self,
id: SwapChainID,
device: &mut Device,
context: &mut Device::Context,
) -> Result<(), Error>
pub fn destroy( &self, id: SwapChainID, device: &mut Device, context: &mut Device::Context, ) -> Result<(), Error>
Destroy a swap chain.
Called by the producer.
Returns an error if context
is not the producer context for the swap chain.
sourcepub fn destroy_all(
&self,
device: &mut Device,
context: &mut Device::Context,
) -> Result<(), Error>
pub fn destroy_all( &self, device: &mut Device, context: &mut Device::Context, ) -> Result<(), Error>
Destroy all the swap chains for a particular producer context. Called by the producer.
Trait Implementations§
source§impl<SwapChainID: Default + Eq + Hash, Device: Default + DeviceAPI> Default for SwapChains<SwapChainID, Device>
impl<SwapChainID: Default + Eq + Hash, Device: Default + DeviceAPI> Default for SwapChains<SwapChainID, Device>
source§fn default() -> SwapChains<SwapChainID, Device>
fn default() -> SwapChains<SwapChainID, Device>
Returns the “default value” for a type. Read more
source§impl<SwapChainID, Device> SwapChainsAPI<SwapChainID> for SwapChains<SwapChainID, Device>
impl<SwapChainID, Device> SwapChainsAPI<SwapChainID> for SwapChains<SwapChainID, Device>
Auto Trait Implementations§
impl<SwapChainID, Device> Freeze for SwapChains<SwapChainID, Device>
impl<SwapChainID, Device> RefUnwindSafe for SwapChains<SwapChainID, Device>
impl<SwapChainID, Device> Send for SwapChains<SwapChainID, Device>
impl<SwapChainID, Device> Sync for SwapChains<SwapChainID, Device>
impl<SwapChainID, Device> Unpin for SwapChains<SwapChainID, Device>
impl<SwapChainID, Device> UnwindSafe for SwapChains<SwapChainID, Device>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more