pub enum Readback {
Texture(Handle<Image>),
Buffer {
buffer: Handle<ShaderBuffer>,
start_offset_and_size: Option<(u64, u64)>,
},
}Expand description
A component that registers the wrapped handle for gpu readback, either a texture or a buffer.
Data is read asynchronously and will be triggered on the entity via the ReadbackComplete event
when complete. If this component is not removed, the readback will be attempted every frame
Variants§
Implementations§
Source§impl Readback
impl Readback
Sourcepub fn texture(image: Handle<Image>) -> Readback
pub fn texture(image: Handle<Image>) -> Readback
Create a readback component for a texture using the given handle.
Examples found in repository?
examples/shader/gpu_readback.rs (line 128)
67fn setup(
68 mut commands: Commands,
69 mut images: ResMut<Assets<Image>>,
70 mut buffers: ResMut<Assets<ShaderBuffer>>,
71) {
72 // Create a storage buffer with some data
73 let buffer: Vec<u32> = (0..BUFFER_LEN as u32).collect();
74 let mut buffer = ShaderBuffer::from(buffer);
75 // We need to enable the COPY_SRC usage so we can copy the buffer to the cpu
76 buffer.buffer_description.usage |= BufferUsages::COPY_SRC;
77 let buffer = buffers.add(buffer);
78
79 // Create a storage texture with some data
80 let size = Extent3d {
81 width: BUFFER_LEN as u32,
82 height: 1,
83 ..default()
84 };
85 // We create an uninitialized image since this texture will only be used for getting data out
86 // of the compute shader, not getting data in, so there's no reason for it to exist on the CPU
87 let mut image = Image::new_uninit(
88 size,
89 TextureDimension::D2,
90 TextureFormat::R32Uint,
91 RenderAssetUsages::RENDER_WORLD,
92 );
93 // We also need to enable the COPY_SRC, as well as STORAGE_BINDING so we can use it in the
94 // compute shader
95 image.texture_descriptor.usage |= TextureUsages::COPY_SRC | TextureUsages::STORAGE_BINDING;
96 let image = images.add(image);
97
98 // Spawn the readback components. For each frame, the data will be read back from the GPU
99 // asynchronously and trigger the `ReadbackComplete` event on this entity. Despawn the entity
100 // to stop reading back the data.
101 commands
102 .spawn(Readback::buffer(buffer.clone()))
103 .observe(|event: On<ReadbackComplete>| {
104 // This matches the type which was used to create the `ShaderBuffer` above,
105 // and is a convenient way to interpret the data.
106 let data: Vec<u32> = event.to_shader_type();
107 info!("Buffer {:?}", data);
108 });
109
110 // It is also possible to read only a range of the buffer.
111 commands
112 .spawn(Readback::buffer_range(
113 buffer.clone(),
114 4 * u32::SHADER_SIZE.get(), // skip the first four elements
115 8 * u32::SHADER_SIZE.get(), // read eight elements
116 ))
117 .observe(|event: On<ReadbackComplete>| {
118 let data: Vec<u32> = event.to_shader_type();
119 info!("Buffer range {:?}", data);
120 });
121
122 // This is just a simple way to pass the buffer handle to the render app for our compute node
123 commands.insert_resource(ReadbackBuffer(buffer));
124
125 // Textures can also be read back from the GPU. Pay careful attention to the format of the
126 // texture, as it will affect how the data is interpreted.
127 commands
128 .spawn(Readback::texture(image.clone()))
129 .observe(|event: On<ReadbackComplete>| {
130 // You probably want to interpret the data as a color rather than a `ShaderType`,
131 // but in this case we know the data is a single channel storage texture, so we can
132 // interpret it as a `Vec<u32>`
133 let data: Vec<u32> = event.to_shader_type();
134 info!("Image {:?}", data);
135 });
136 commands.insert_resource(ReadbackImage(image));
137}Sourcepub fn buffer(buffer: Handle<ShaderBuffer>) -> Readback
pub fn buffer(buffer: Handle<ShaderBuffer>) -> Readback
Create a readback component for a full buffer using the given handle.
Examples found in repository?
examples/shader/gpu_readback.rs (line 102)
67fn setup(
68 mut commands: Commands,
69 mut images: ResMut<Assets<Image>>,
70 mut buffers: ResMut<Assets<ShaderBuffer>>,
71) {
72 // Create a storage buffer with some data
73 let buffer: Vec<u32> = (0..BUFFER_LEN as u32).collect();
74 let mut buffer = ShaderBuffer::from(buffer);
75 // We need to enable the COPY_SRC usage so we can copy the buffer to the cpu
76 buffer.buffer_description.usage |= BufferUsages::COPY_SRC;
77 let buffer = buffers.add(buffer);
78
79 // Create a storage texture with some data
80 let size = Extent3d {
81 width: BUFFER_LEN as u32,
82 height: 1,
83 ..default()
84 };
85 // We create an uninitialized image since this texture will only be used for getting data out
86 // of the compute shader, not getting data in, so there's no reason for it to exist on the CPU
87 let mut image = Image::new_uninit(
88 size,
89 TextureDimension::D2,
90 TextureFormat::R32Uint,
91 RenderAssetUsages::RENDER_WORLD,
92 );
93 // We also need to enable the COPY_SRC, as well as STORAGE_BINDING so we can use it in the
94 // compute shader
95 image.texture_descriptor.usage |= TextureUsages::COPY_SRC | TextureUsages::STORAGE_BINDING;
96 let image = images.add(image);
97
98 // Spawn the readback components. For each frame, the data will be read back from the GPU
99 // asynchronously and trigger the `ReadbackComplete` event on this entity. Despawn the entity
100 // to stop reading back the data.
101 commands
102 .spawn(Readback::buffer(buffer.clone()))
103 .observe(|event: On<ReadbackComplete>| {
104 // This matches the type which was used to create the `ShaderBuffer` above,
105 // and is a convenient way to interpret the data.
106 let data: Vec<u32> = event.to_shader_type();
107 info!("Buffer {:?}", data);
108 });
109
110 // It is also possible to read only a range of the buffer.
111 commands
112 .spawn(Readback::buffer_range(
113 buffer.clone(),
114 4 * u32::SHADER_SIZE.get(), // skip the first four elements
115 8 * u32::SHADER_SIZE.get(), // read eight elements
116 ))
117 .observe(|event: On<ReadbackComplete>| {
118 let data: Vec<u32> = event.to_shader_type();
119 info!("Buffer range {:?}", data);
120 });
121
122 // This is just a simple way to pass the buffer handle to the render app for our compute node
123 commands.insert_resource(ReadbackBuffer(buffer));
124
125 // Textures can also be read back from the GPU. Pay careful attention to the format of the
126 // texture, as it will affect how the data is interpreted.
127 commands
128 .spawn(Readback::texture(image.clone()))
129 .observe(|event: On<ReadbackComplete>| {
130 // You probably want to interpret the data as a color rather than a `ShaderType`,
131 // but in this case we know the data is a single channel storage texture, so we can
132 // interpret it as a `Vec<u32>`
133 let data: Vec<u32> = event.to_shader_type();
134 info!("Image {:?}", data);
135 });
136 commands.insert_resource(ReadbackImage(image));
137}Sourcepub fn buffer_range(
buffer: Handle<ShaderBuffer>,
start_offset: u64,
size: u64,
) -> Readback
pub fn buffer_range( buffer: Handle<ShaderBuffer>, start_offset: u64, size: u64, ) -> Readback
Create a readback component for a buffer range using the given handle, a start offset in bytes and a number of bytes to read.
Examples found in repository?
examples/shader/gpu_readback.rs (lines 112-116)
67fn setup(
68 mut commands: Commands,
69 mut images: ResMut<Assets<Image>>,
70 mut buffers: ResMut<Assets<ShaderBuffer>>,
71) {
72 // Create a storage buffer with some data
73 let buffer: Vec<u32> = (0..BUFFER_LEN as u32).collect();
74 let mut buffer = ShaderBuffer::from(buffer);
75 // We need to enable the COPY_SRC usage so we can copy the buffer to the cpu
76 buffer.buffer_description.usage |= BufferUsages::COPY_SRC;
77 let buffer = buffers.add(buffer);
78
79 // Create a storage texture with some data
80 let size = Extent3d {
81 width: BUFFER_LEN as u32,
82 height: 1,
83 ..default()
84 };
85 // We create an uninitialized image since this texture will only be used for getting data out
86 // of the compute shader, not getting data in, so there's no reason for it to exist on the CPU
87 let mut image = Image::new_uninit(
88 size,
89 TextureDimension::D2,
90 TextureFormat::R32Uint,
91 RenderAssetUsages::RENDER_WORLD,
92 );
93 // We also need to enable the COPY_SRC, as well as STORAGE_BINDING so we can use it in the
94 // compute shader
95 image.texture_descriptor.usage |= TextureUsages::COPY_SRC | TextureUsages::STORAGE_BINDING;
96 let image = images.add(image);
97
98 // Spawn the readback components. For each frame, the data will be read back from the GPU
99 // asynchronously and trigger the `ReadbackComplete` event on this entity. Despawn the entity
100 // to stop reading back the data.
101 commands
102 .spawn(Readback::buffer(buffer.clone()))
103 .observe(|event: On<ReadbackComplete>| {
104 // This matches the type which was used to create the `ShaderBuffer` above,
105 // and is a convenient way to interpret the data.
106 let data: Vec<u32> = event.to_shader_type();
107 info!("Buffer {:?}", data);
108 });
109
110 // It is also possible to read only a range of the buffer.
111 commands
112 .spawn(Readback::buffer_range(
113 buffer.clone(),
114 4 * u32::SHADER_SIZE.get(), // skip the first four elements
115 8 * u32::SHADER_SIZE.get(), // read eight elements
116 ))
117 .observe(|event: On<ReadbackComplete>| {
118 let data: Vec<u32> = event.to_shader_type();
119 info!("Buffer range {:?}", data);
120 });
121
122 // This is just a simple way to pass the buffer handle to the render app for our compute node
123 commands.insert_resource(ReadbackBuffer(buffer));
124
125 // Textures can also be read back from the GPU. Pay careful attention to the format of the
126 // texture, as it will affect how the data is interpreted.
127 commands
128 .spawn(Readback::texture(image.clone()))
129 .observe(|event: On<ReadbackComplete>| {
130 // You probably want to interpret the data as a color rather than a `ShaderType`,
131 // but in this case we know the data is a single channel storage texture, so we can
132 // interpret it as a `Vec<u32>`
133 let data: Vec<u32> = event.to_shader_type();
134 info!("Image {:?}", data);
135 });
136 commands.insert_resource(ReadbackImage(image));
137}Trait Implementations§
Source§impl Component for Readback
impl Component for Readback
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
A constant indicating the storage type used for this component.
Source§type Mutability = Mutable
type Mutability = Mutable
A marker type to assist Bevy with determining if this component is
mutable, or immutable. Mutable components will have
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Registers required components. Read more
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Called when registering this component, allowing to override clone function (or disable cloning altogether) for this component. Read more
Source§fn map_entities<M>(this: &mut Readback, mapper: &mut M)where
M: EntityMapper,
fn map_entities<M>(this: &mut Readback, mapper: &mut M)where
M: EntityMapper,
Maps the entities on this component using the given
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Readback>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Readback>>
Returns
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§impl ExtractComponent for Readback
impl ExtractComponent for Readback
Source§type QueryData = &'static Readback
type QueryData = &'static Readback
ECS
ReadOnlyQueryData to fetch the components to extract.Source§type QueryFilter = ()
type QueryFilter = ()
Filters the entities with additional constraints.
Source§type Out = Readback
type Out = Readback
The output from extraction, i.e.
ExtractComponent::extract_component. Read moreSource§fn extract_component(
item: <<Readback as ExtractComponent>::QueryData as QueryData>::Item<'_, '_>,
) -> Option<<Readback as ExtractComponent>::Out>
fn extract_component( item: <<Readback as ExtractComponent>::QueryData as QueryData>::Item<'_, '_>, ) -> Option<<Readback as ExtractComponent>::Out>
Defines how the component is transferred into the “render world”. Read more
Source§impl FromTemplate for Readback
impl FromTemplate for Readback
Source§type Template = ReadbackTemplate
type Template = ReadbackTemplate
The
Template for this type.Source§impl SyncComponent for Readback
impl SyncComponent for Readback
impl Unpin for Readbackwhere
[()]: for<'a> SpecializeFromTemplate,
Auto Trait Implementations§
impl !RefUnwindSafe for Readback
impl !UnwindSafe for Readback
impl Freeze for Readback
impl Send for Readback
impl Sync for Readback
impl UnsafeUnpin for Readback
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
Return the
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
Source§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Moves the components out of the bundle. Read more
Source§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
Applies the after-effects of spawning this bundle. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T> HitDataExtra for T
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.
Source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<G> PatchFromTemplate for Gwhere
G: FromTemplate,
impl<G> PatchFromTemplate for Gwhere
G: FromTemplate,
Source§fn patch<F>(func: F) -> TemplatePatch<F, <G as PatchFromTemplate>::Template>
fn patch<F>(func: F) -> TemplatePatch<F, <G as PatchFromTemplate>::Template>
Takes a “patch function”
func, and turns it into a TemplatePatch.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Settings for T
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
Creates a type-erased clone of this value.