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>where SwapChainID: Clone + Eq + Hash + Debug, Device: DeviceAPI,

source

pub fn new() -> SwapChains<SwapChainID, Device>

Create a new collection.

source

fn ids(&self) -> MutexGuard<'_, FnvHashMap<ContextID, FnvHashSet<SwapChainID>>>

source

fn table( &self ) -> RwLockReadGuard<'_, FnvHashMap<SwapChainID, SwapChain<Device>>>

source

fn table_mut( &self ) -> RwLockWriteGuard<'_, FnvHashMap<SwapChainID, SwapChain<Device>>>

source

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.

source

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.

source

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.

source

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.

source

pub fn iter( &self, device: &mut Device, context: &mut Device::Context ) -> impl Iterator<Item = (SwapChainID, SwapChain<Device>)>

Iterate over all the swap chains for a particular producer context. Called by the producer.

Trait Implementations§

source§

impl<SwapChainID: Eq + Hash, Device: DeviceAPI> Clone for SwapChains<SwapChainID, Device>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<SwapChainID: Default + Eq + Hash, Device: Default + DeviceAPI> Default for SwapChains<SwapChainID, Device>

source§

fn default() -> SwapChains<SwapChainID, Device>

Returns the “default value” for a type. Read more
source§

impl<SwapChainID, Device> SwapChainsAPI<SwapChainID> for SwapChains<SwapChainID, Device>where SwapChainID: 'static + Clone + Eq + Hash + Debug + Sync + Send, Device: 'static + DeviceAPI, Device::Surface: Send,

source§

fn get(&self, id: SwapChainID) -> Option<SwapChain<Device>>

Get a swap chain

§

type Surface = <Device as Device>::Surface

§

type SwapChain = SwapChain<Device>

Auto Trait Implementations§

§

impl<SwapChainID, Device> RefUnwindSafe for SwapChains<SwapChainID, Device>

§

impl<SwapChainID, Device> Send for SwapChains<SwapChainID, Device>where SwapChainID: Send + Sync, <Device as Device>::Surface: Send,

§

impl<SwapChainID, Device> Sync for SwapChains<SwapChainID, Device>where SwapChainID: Send + Sync, <Device as Device>::Surface: Send,

§

impl<SwapChainID, Device> Unpin for SwapChains<SwapChainID, Device>

§

impl<SwapChainID, Device> UnwindSafe for SwapChains<SwapChainID, Device>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.