mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-22 23:41:01 +01:00
Implement Clone for Module (#2013)
This is hidden behind the `clone` feature flag
This commit is contained in:
1 parent
a80967f860
commit
48e79388b5
3 files changed
+12
No files matched your search
@@ -23,6 +23,7 @@ panic = "abort"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
clone = []
|
||||
dot-out = []
|
||||
glsl-in = ["pp-rs"]
|
||||
glsl-validate = []
|
||||
|
||||
@@ -161,6 +161,7 @@ impl<T> Iterator for Range<T> {
|
||||
/// Adding new items to the arena produces a strongly-typed [`Handle`].
|
||||
/// The arena can be indexed using the given handle to obtain
|
||||
/// a reference to the stored item.
|
||||
#[cfg_attr(feature = "clone", derive(Clone))]
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
|
||||
#[cfg_attr(feature = "serialize", serde(transparent))]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@@ -412,6 +413,7 @@ mod tests {
|
||||
///
|
||||
/// `UniqueArena` is similar to [`Arena`]: If `Arena` is vector-like,
|
||||
/// `UniqueArena` is `HashSet`-like.
|
||||
#[cfg_attr(feature = "clone", derive(Clone))]
|
||||
pub struct UniqueArena<T> {
|
||||
set: IndexSet<T>,
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ with optional span info, representing a series of statements executed in order.
|
||||
`EntryPoint`s or `Function` is a `Block`, and `Statement` has a
|
||||
[`Block`][Statement::Block] variant.
|
||||
|
||||
If the `clone` feature is enabled, [`Arena`], [`UniqueArena`], [`Type`], [`TypeInner`],
|
||||
[`Constant`], [`Function`], [`EntryPoint`] and [`Module`] can be cloned.
|
||||
|
||||
## Arenas
|
||||
|
||||
To improve translator performance and reduce memory usage, most structures are
|
||||
@@ -558,6 +561,7 @@ pub enum ImageClass {
|
||||
|
||||
/// A data type declared in the module.
|
||||
#[derive(Debug, Eq, Hash, PartialEq)]
|
||||
#[cfg_attr(feature = "clone", derive(Clone))]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
||||
@@ -570,6 +574,7 @@ pub struct Type {
|
||||
|
||||
/// Enum with additional information, depending on the kind of type.
|
||||
#[derive(Debug, Eq, Hash, PartialEq)]
|
||||
#[cfg_attr(feature = "clone", derive(Clone))]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
||||
@@ -746,6 +751,7 @@ pub enum TypeInner {
|
||||
|
||||
/// Constant value.
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "clone", derive(Clone))]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
||||
@@ -1585,6 +1591,7 @@ pub struct FunctionResult {
|
||||
|
||||
/// A function defined in the module.
|
||||
#[derive(Debug, Default)]
|
||||
#[cfg_attr(feature = "clone", derive(Clone))]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
||||
@@ -1649,6 +1656,7 @@ pub struct Function {
|
||||
/// [`function`]: EntryPoint::function
|
||||
/// [`stage`]: EntryPoint::stage
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "clone", derive(Clone))]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
||||
@@ -1679,6 +1687,7 @@ pub struct EntryPoint {
|
||||
///
|
||||
/// When finished, you can export modules using one of the [available backends][back].
|
||||
#[derive(Debug, Default)]
|
||||
#[cfg_attr(feature = "clone", derive(Clone))]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
||||
|
||||
Reference in new issue
Block a user