ComputePass

Struct ComputePass 

Source
pub struct ComputePass<'encoder> { /* private fields */ }
Expand description

In-progress recording of a compute pass.

It can be created with CommandEncoder::begin_compute_pass.

Corresponds to WebGPU GPUComputePassEncoder.

Implementations§

Source§

impl ComputePass<'_>

Source

pub fn forget_lifetime(self) -> ComputePass<'static>

Drops the lifetime relationship to the parent command encoder, making usage of the encoder while this pass is recorded a run-time error instead.

Attention: As long as the compute pass has not been ended, any mutating operation on the parent command encoder will cause a run-time error and invalidate it! By default, the lifetime constraint prevents this, but it can be useful to handle this at run time, such as when storing the pass and encoder in the same data structure.

This operation has no effect on pass recording. It’s a safe operation, since CommandEncoder is in a locked state as long as the pass is active regardless of the lifetime constraint or its absence.

Source

pub fn set_bind_group<'a, BG>( &mut self, index: u32, bind_group: BG, offsets: &[u32], )
where Option<&'a BindGroup>: From<BG>,

Sets the active bind group for a given bind group index. The bind group layout in the active pipeline when the dispatch() function is called must match the layout of this bind group.

If the bind group have dynamic offsets, provide them in the binding order. These offsets have to be aligned to Limits::min_uniform_buffer_offset_alignment or Limits::min_storage_buffer_offset_alignment appropriately.

Examples found in repository?
examples/shader/gpu_readback.rs (line 234)
215    fn run(
216        &self,
217        _graph: &mut render_graph::RenderGraphContext,
218        render_context: &mut RenderContext,
219        world: &World,
220    ) -> Result<(), render_graph::NodeRunError> {
221        let pipeline_cache = world.resource::<PipelineCache>();
222        let pipeline = world.resource::<ComputePipeline>();
223        let bind_group = world.resource::<GpuBufferBindGroup>();
224
225        if let Some(init_pipeline) = pipeline_cache.get_compute_pipeline(pipeline.pipeline) {
226            let mut pass =
227                render_context
228                    .command_encoder()
229                    .begin_compute_pass(&ComputePassDescriptor {
230                        label: Some("GPU readback compute pass"),
231                        ..default()
232                    });
233
234            pass.set_bind_group(0, &bind_group.0, &[]);
235            pass.set_pipeline(init_pipeline);
236            pass.dispatch_workgroups(BUFFER_LEN as u32, 1, 1);
237        }
238        Ok(())
239    }
More examples
Hide additional examples
examples/shader/compute_shader_game_of_life.rs (line 291)
270    fn run(
271        &self,
272        _graph: &mut render_graph::RenderGraphContext,
273        render_context: &mut RenderContext,
274        world: &World,
275    ) -> Result<(), render_graph::NodeRunError> {
276        let bind_groups = &world.resource::<GameOfLifeImageBindGroups>().0;
277        let pipeline_cache = world.resource::<PipelineCache>();
278        let pipeline = world.resource::<GameOfLifePipeline>();
279
280        let mut pass = render_context
281            .command_encoder()
282            .begin_compute_pass(&ComputePassDescriptor::default());
283
284        // select the pipeline based on the current state
285        match self.state {
286            GameOfLifeState::Loading => {}
287            GameOfLifeState::Init => {
288                let init_pipeline = pipeline_cache
289                    .get_compute_pipeline(pipeline.init_pipeline)
290                    .unwrap();
291                pass.set_bind_group(0, &bind_groups[0], &[]);
292                pass.set_pipeline(init_pipeline);
293                pass.dispatch_workgroups(SIZE.x / WORKGROUP_SIZE, SIZE.y / WORKGROUP_SIZE, 1);
294            }
295            GameOfLifeState::Update(index) => {
296                let update_pipeline = pipeline_cache
297                    .get_compute_pipeline(pipeline.update_pipeline)
298                    .unwrap();
299                pass.set_bind_group(0, &bind_groups[index], &[]);
300                pass.set_pipeline(update_pipeline);
301                pass.dispatch_workgroups(SIZE.x / WORKGROUP_SIZE, SIZE.y / WORKGROUP_SIZE, 1);
302            }
303        }
304
305        Ok(())
306    }
Source

pub fn set_pipeline(&mut self, pipeline: &ComputePipeline)

Sets the active compute pipeline.

Examples found in repository?
examples/shader/gpu_readback.rs (line 235)
215    fn run(
216        &self,
217        _graph: &mut render_graph::RenderGraphContext,
218        render_context: &mut RenderContext,
219        world: &World,
220    ) -> Result<(), render_graph::NodeRunError> {
221        let pipeline_cache = world.resource::<PipelineCache>();
222        let pipeline = world.resource::<ComputePipeline>();
223        let bind_group = world.resource::<GpuBufferBindGroup>();
224
225        if let Some(init_pipeline) = pipeline_cache.get_compute_pipeline(pipeline.pipeline) {
226            let mut pass =
227                render_context
228                    .command_encoder()
229                    .begin_compute_pass(&ComputePassDescriptor {
230                        label: Some("GPU readback compute pass"),
231                        ..default()
232                    });
233
234            pass.set_bind_group(0, &bind_group.0, &[]);
235            pass.set_pipeline(init_pipeline);
236            pass.dispatch_workgroups(BUFFER_LEN as u32, 1, 1);
237        }
238        Ok(())
239    }
More examples
Hide additional examples
examples/shader/compute_shader_game_of_life.rs (line 292)
270    fn run(
271        &self,
272        _graph: &mut render_graph::RenderGraphContext,
273        render_context: &mut RenderContext,
274        world: &World,
275    ) -> Result<(), render_graph::NodeRunError> {
276        let bind_groups = &world.resource::<GameOfLifeImageBindGroups>().0;
277        let pipeline_cache = world.resource::<PipelineCache>();
278        let pipeline = world.resource::<GameOfLifePipeline>();
279
280        let mut pass = render_context
281            .command_encoder()
282            .begin_compute_pass(&ComputePassDescriptor::default());
283
284        // select the pipeline based on the current state
285        match self.state {
286            GameOfLifeState::Loading => {}
287            GameOfLifeState::Init => {
288                let init_pipeline = pipeline_cache
289                    .get_compute_pipeline(pipeline.init_pipeline)
290                    .unwrap();
291                pass.set_bind_group(0, &bind_groups[0], &[]);
292                pass.set_pipeline(init_pipeline);
293                pass.dispatch_workgroups(SIZE.x / WORKGROUP_SIZE, SIZE.y / WORKGROUP_SIZE, 1);
294            }
295            GameOfLifeState::Update(index) => {
296                let update_pipeline = pipeline_cache
297                    .get_compute_pipeline(pipeline.update_pipeline)
298                    .unwrap();
299                pass.set_bind_group(0, &bind_groups[index], &[]);
300                pass.set_pipeline(update_pipeline);
301                pass.dispatch_workgroups(SIZE.x / WORKGROUP_SIZE, SIZE.y / WORKGROUP_SIZE, 1);
302            }
303        }
304
305        Ok(())
306    }
Source

pub fn insert_debug_marker(&mut self, label: &str)

Inserts debug marker.

Source

pub fn push_debug_group(&mut self, label: &str)

Start record commands and group it into debug marker group.

Source

pub fn pop_debug_group(&mut self)

Stops command recording and creates debug group.

Source

pub fn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32)

Dispatches compute work operations.

x, y and z denote the number of work groups to dispatch in each dimension.

Examples found in repository?
examples/shader/gpu_readback.rs (line 236)
215    fn run(
216        &self,
217        _graph: &mut render_graph::RenderGraphContext,
218        render_context: &mut RenderContext,
219        world: &World,
220    ) -> Result<(), render_graph::NodeRunError> {
221        let pipeline_cache = world.resource::<PipelineCache>();
222        let pipeline = world.resource::<ComputePipeline>();
223        let bind_group = world.resource::<GpuBufferBindGroup>();
224
225        if let Some(init_pipeline) = pipeline_cache.get_compute_pipeline(pipeline.pipeline) {
226            let mut pass =
227                render_context
228                    .command_encoder()
229                    .begin_compute_pass(&ComputePassDescriptor {
230                        label: Some("GPU readback compute pass"),
231                        ..default()
232                    });
233
234            pass.set_bind_group(0, &bind_group.0, &[]);
235            pass.set_pipeline(init_pipeline);
236            pass.dispatch_workgroups(BUFFER_LEN as u32, 1, 1);
237        }
238        Ok(())
239    }
More examples
Hide additional examples
examples/shader/compute_shader_game_of_life.rs (line 293)
270    fn run(
271        &self,
272        _graph: &mut render_graph::RenderGraphContext,
273        render_context: &mut RenderContext,
274        world: &World,
275    ) -> Result<(), render_graph::NodeRunError> {
276        let bind_groups = &world.resource::<GameOfLifeImageBindGroups>().0;
277        let pipeline_cache = world.resource::<PipelineCache>();
278        let pipeline = world.resource::<GameOfLifePipeline>();
279
280        let mut pass = render_context
281            .command_encoder()
282            .begin_compute_pass(&ComputePassDescriptor::default());
283
284        // select the pipeline based on the current state
285        match self.state {
286            GameOfLifeState::Loading => {}
287            GameOfLifeState::Init => {
288                let init_pipeline = pipeline_cache
289                    .get_compute_pipeline(pipeline.init_pipeline)
290                    .unwrap();
291                pass.set_bind_group(0, &bind_groups[0], &[]);
292                pass.set_pipeline(init_pipeline);
293                pass.dispatch_workgroups(SIZE.x / WORKGROUP_SIZE, SIZE.y / WORKGROUP_SIZE, 1);
294            }
295            GameOfLifeState::Update(index) => {
296                let update_pipeline = pipeline_cache
297                    .get_compute_pipeline(pipeline.update_pipeline)
298                    .unwrap();
299                pass.set_bind_group(0, &bind_groups[index], &[]);
300                pass.set_pipeline(update_pipeline);
301                pass.dispatch_workgroups(SIZE.x / WORKGROUP_SIZE, SIZE.y / WORKGROUP_SIZE, 1);
302            }
303        }
304
305        Ok(())
306    }
Source

pub fn dispatch_workgroups_indirect( &mut self, indirect_buffer: &Buffer, indirect_offset: u64, )

Dispatches compute work operations, based on the contents of the indirect_buffer.

The structure expected in indirect_buffer must conform to DispatchIndirectArgs.

Source§

impl ComputePass<'_>

Features::PUSH_CONSTANTS must be enabled on the device in order to call these functions.

Source

pub fn set_push_constants(&mut self, offset: u32, data: &[u8])

Set push constant data for subsequent dispatch calls.

Write the bytes in data at offset offset within push constant storage. Both offset and the length of data must be multiples of PUSH_CONSTANT_ALIGNMENT, which is always 4.

For example, if offset is 4 and data is eight bytes long, this call will write data to bytes 4..12 of push constant storage.

Source§

impl ComputePass<'_>

Features::TIMESTAMP_QUERY_INSIDE_PASSES must be enabled on the device in order to call these functions.

Source

pub fn write_timestamp(&mut self, query_set: &QuerySet, query_index: u32)

Issue a timestamp command at this point in the queue. The timestamp will be written to the specified query set, at the specified index.

Must be multiplied by Queue::get_timestamp_period to get the value in nanoseconds. Absolute values have no meaning, but timestamps can be subtracted to get the time it takes for a string of operations to complete.

Source§

impl ComputePass<'_>

Features::PIPELINE_STATISTICS_QUERY must be enabled on the device in order to call these functions.

Source

pub fn begin_pipeline_statistics_query( &mut self, query_set: &QuerySet, query_index: u32, )

Start a pipeline statistics query on this compute pass. It can be ended with end_pipeline_statistics_query. Pipeline statistics queries may not be nested.

Source

pub fn end_pipeline_statistics_query(&mut self)

End the pipeline statistics query on this compute pass. It can be started with begin_pipeline_statistics_query. Pipeline statistics queries may not be nested.

Trait Implementations§

Source§

impl<'encoder> Debug for ComputePass<'encoder>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Hash for ComputePass<'_>

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ComputePass<'_>

Source§

fn cmp(&self, other: &ComputePass<'_>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ComputePass<'_>

Source§

fn eq(&self, other: &ComputePass<'_>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ComputePass<'_>

Source§

fn partial_cmp(&self, other: &ComputePass<'_>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for ComputePass<'_>

Auto Trait Implementations§

§

impl<'encoder> Freeze for ComputePass<'encoder>

§

impl<'encoder> !RefUnwindSafe for ComputePass<'encoder>

§

impl<'encoder> Send for ComputePass<'encoder>

§

impl<'encoder> Sync for ComputePass<'encoder>

§

impl<'encoder> Unpin for ComputePass<'encoder>

§

impl<'encoder> !UnwindSafe for ComputePass<'encoder>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

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> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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 T
where T: Any,

Source§

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>

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)

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)

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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynEq for T
where T: Any + Eq,

Source§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
Source§

impl<T> DynHash for T
where T: DynEq + Hash,

Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Feeds this value into the given Hasher.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> FmtForward for T

Source§

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,

Causes self to use its Display implementation when Debug-formatted.
Source§

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,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

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,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

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,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where 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) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

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

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
where Self: Borrow<B>, B: ?Sized,

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
where Self: BorrowMut<B>, B: ?Sized,

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
where Self: AsRef<R>, R: ?Sized,

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
where Self: AsMut<R>, R: ?Sized,

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
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> Settings for T
where T: 'static + Send + Sync,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,