pub struct MessageWriter<'w, M>where
M: Message,{ /* private fields */ }Expand description
Writes Messages of type T.
This system parameter takes exclusive access to the Messages<T> resource,
so a system cannot also have a MessageReader parameter of the same type.
If you need to both read and write messages of the same type,
use MessageMutator.
§Usage
MessageWriters are usually declared as a SystemParam.
#[derive(Message)]
pub struct MyMessage(String); // Custom message type.
fn my_system(mut writer: MessageWriter<MyMessage>) {
writer.write(MyMessage("My custom payload!".to_string()));
}
§Concurrency
MessageWriter param has ResMut<Messages<T>> inside. So two systems declaring MessageWriter<T> params
for the same message type won’t be executed concurrently.
§Untyped messages
MessageWriter can only write messages of one specific type, which must be known at compile-time.
This is not a problem most of the time, but you may find a situation where you cannot know
ahead of time every kind of message you’ll need to write. In this case, you can use the “type-erased message” pattern.
fn write_untyped(mut commands: Commands) {
// Write a message of a specific type without having to declare that
// type as a SystemParam.
//
// Effectively, we're just moving the type parameter from the /type/ to the /method/,
// which allows one to do all kinds of clever things with type erasure, such as sending
// custom messages to unknown 3rd party plugins (modding API).
//
// NOTE: the message won't actually be sent until commands get applied during
// apply_deferred.
commands.queue(|w: &mut World| {
w.write_message(MyMessage);
});
}Note that this is considered non-idiomatic, and should only be used when MessageWriter will not work.
Implementations§
Source§impl<'w, M> MessageWriter<'w, M>where
M: Message,
impl<'w, M> MessageWriter<'w, M>where
M: Message,
Sourcepub fn write(&mut self, message: M) -> MessageId<M>
pub fn write(&mut self, message: M) -> MessageId<M>
Writes an message, which can later be read by MessageReaders.
This method returns the ID of the written message.
See Messages for details.
Examples found in repository?
More examples
40fn deal_damage_over_time(
41 time: Res<Time>,
42 mut state: ResMut<DamageTimer>,
43 mut deal_damage_writer: MessageWriter<DealDamage>,
44) {
45 if state.tick(time.delta()).is_finished() {
46 // Messages can be sent with 'write' and constructed just like any other object.
47 deal_damage_writer.write(DealDamage { amount: 10 });
48 }
49}
50
51// This system both reads and writes `DealDamage` messages.
52//
53// Trying to do this with a `MessageReader` and a `MessageWriter` will fail with conflicts,
54// since they both use the same underlying resource.
55// Instead, you may use a `MessageMutator`, which allows both reading and writing.
56fn apply_extra_damage(mut dmg_messages: MessageMutator<DealDamage>) {
57 let mut extra = Vec::new();
58 for message in dmg_messages.read() {
59 if message.amount >= 10 {
60 extra.push(DealDamage {
61 amount: message.amount / 10,
62 });
63 }
64 }
65 // Note that this system will read messages it wrote itself!
66 // These are written after the `read()`, so they will be read the next time it runs.
67 for message in extra {
68 dmg_messages.write(message);
69 }
70}
71
72// This system mutates the 'DealDamage' messages to apply some armor value
73// It also sends an 'ArmorBlockedDamage' message if the value of 'DealDamage' is zero
74//
75// Messages are mutated using an 'MessageMutator<T>' by calling 'read'. This returns an iterator
76// over all the &mut T that this system has not read yet. Note, you can have multiple
77// 'MessageReader', 'MessageWriter', and 'MessageMutator' in a given system, as long as the types (T) are different.
78fn apply_armor_to_damage(
79 mut dmg_messages: MessageMutator<DealDamage>,
80 mut armor_messages: MessageWriter<ArmorBlockedDamage>,
81) {
82 for message in dmg_messages.read() {
83 message.amount -= 1;
84 if message.amount <= 0 {
85 // Zero-sized messages can also be sent with 'send'
86 armor_messages.write(ArmorBlockedDamage);
87 }
88 }
89}305fn setup(
306 mut commands: Commands,
307 mut regenerate_image_message_writer: MessageWriter<RegenerateImage>,
308) {
309 // Spawn the camera.
310 commands.spawn(Camera2d);
311
312 // Spawn the UI widgets at the bottom of the window.
313 spawn_ui(&mut commands);
314
315 // Schedule the image to be generated.
316 regenerate_image_message_writer.write(RegenerateImage);
317}
318
319/// Spawns the UI widgets at the bottom of the window.
320fn spawn_ui(commands: &mut Commands) {
321 commands.spawn_scene(bsn! {
322 @main_ui_node_scene()
323 Children [
324 // Spawn the "Regenerate Top Mip Level" button.
325 @FeathersButton {
326 @caption: bsn! { @caption("Regenerate Top Mip Level") }
327 }
328 RegenerateTopMipLevelButton
329 Node {
330 justify_content: JustifyContent::Center,
331 align_items: AlignItems::Center,
332 }
333 BackgroundColor(Color::BLACK)
334 --
335 // Spawn the "Mip Generation" switch that allows the user to toggle
336 // mip generation on and off.
337 @feathers_option_buttons(
338 "Mip Generation",
339 &[
340 (
341 EnableMipGeneration::On,
342 "On"
343 ),
344 (
345 EnableMipGeneration::Off,
346 "Off"
347 ),
348 ], 0
349 )
350 --
351 // Spawn the "Image Width" control that allows the user to set the
352 // width of the image.
353 @feathers_option_buttons(
354 "Image Width",
355 &[
356 (ImageSizeSetting::ImageWidth(ImageSize::Size240), "240"),
357 (ImageSizeSetting::ImageWidth(ImageSize::Size480), "480"),
358 (ImageSizeSetting::ImageWidth(ImageSize::Size640), "640"),
359 (ImageSizeSetting::ImageWidth(ImageSize::Size1080), "1080"),
360 (ImageSizeSetting::ImageWidth(ImageSize::Size1920), "1920"),
361 ],
362 2
363 )
364 --
365 // Spawn the "Image Height" control that allows the user to set the
366 // height of the image.
367 @feathers_option_buttons(
368 "Image Height",
369 &[
370 (ImageSizeSetting::ImageHeight(ImageSize::Size240), "240"),
371 (ImageSizeSetting::ImageHeight(ImageSize::Size480), "480"),
372 (ImageSizeSetting::ImageHeight(ImageSize::Size640), "640"),
373 (ImageSizeSetting::ImageHeight(ImageSize::Size1080), "1080"),
374 (ImageSizeSetting::ImageHeight(ImageSize::Size1920), "1920"),
375 ],
376 1
377 )
378 ]
379 });
380}
381
382impl MipmapSizeIterator {
383 /// Creates a [`MipmapSizeIterator`] corresponding to the size of the image
384 /// currently being displayed.
385 fn new(app_status: &AppStatus) -> MipmapSizeIterator {
386 MipmapSizeIterator {
387 size: Some(app_status.image_size_u32()),
388 }
389 }
390}
391
392impl Iterator for MipmapSizeIterator {
393 type Item = UVec2;
394
395 fn next(&mut self) -> Option<Self::Item> {
396 // The size of mipmap level N + 1 is equal to half the size of mipmap
397 // level N, rounding down, except that the size can never go below 1
398 // pixel on either axis.
399 let result = self.size;
400 if let Some(size) = self.size {
401 self.size = if size == UVec2::splat(1) {
402 None
403 } else {
404 Some((size / 2).max(UVec2::splat(1)))
405 };
406 }
407 result
408 }
409}
410
411/// Updates the size of the image on the left side of the window each frame.
412///
413/// Resizing the image every frame effectively cycles through all the image's
414/// mipmap levels, demonstrating the difference between the presence of mipmap
415/// levels and their absence.
416fn animate_image_scale(
417 mut animated_images_query: Query<&mut Transform, With<AnimatedImage>>,
418 windows_query: Query<&Window, With<PrimaryWindow>>,
419 app_status: Res<AppStatus>,
420 time: Res<Time>,
421) {
422 let window_size = windows_query.iter().next().unwrap().size();
423 let animated_mesh_size = app_status.animated_mesh_size(window_size);
424
425 for mut animated_image_transform in &mut animated_images_query {
426 animated_image_transform.scale =
427 animated_mesh_size.extend(1.0) * triangle_wave(time.elapsed_secs(), ANIMATION_PERIOD);
428 }
429}
430
431/// Evaluates a [triangle wave] with the given wavelength.
432///
433/// This is used as part of [`animate_image_scale`], to derive the scale from
434/// the current elapsed time.
435///
436/// [triangle wave]: https://en.wikipedia.org/wiki/Triangle_wave#Definition
437fn triangle_wave(time: f32, wavelength: f32) -> f32 {
438 2.0 * ops::abs(time / wavelength - ops::floor(time / wavelength + 0.5))
439}
440
441/// Adds the top mipmap level of the image to [`MipGenerationJobs`].
442///
443/// Note that this must run in the render world, not the main world, as
444/// [`MipGenerationJobs`] is a resource that exists in the former. Consequently,
445/// it must use [`Extract`] to access main world resources.
446fn extract_mipmap_source_image(
447 mipmap_source_image: Extract<Res<MipmapSourceImage>>,
448 app_status: Extract<Res<AppStatus>>,
449 mut mip_generation_jobs: ResMut<MipGenerationJobs>,
450) {
451 if app_status.enable_mip_generation == EnableMipGeneration::On {
452 mip_generation_jobs.add(MIP_GENERATION_PHASE_ID, mipmap_source_image.id());
453 }
454}
455
456/// Handles the button activation of the `RegenerateTopMipLevelButton`.
457fn handle_regenerate_top_mip_level_activate(
458 event: On<Activate>,
459 q: Query<(), With<RegenerateTopMipLevelButton>>,
460 mut regenerate_image_message_writer: MessageWriter<RegenerateImage>,
461) {
462 if q.contains(event.entity) {
463 // Schedule the image to be regenerated.
464 regenerate_image_message_writer.write(RegenerateImage);
465 }
466}
467
468/// Handles a request from the user to change the enable mip generation setting via the UI.
469fn handle_enable_mip_generation_change(
470 event: On<ValueChange<Entity>>,
471 new_value_query: Query<&RadioButtonOptionValue<EnableMipGeneration>>,
472 mut app_status: ResMut<AppStatus>,
473) {
474 let Ok(RadioButtonOptionValue(enable_mip)) = new_value_query.get(event.value) else {
475 return;
476 };
477 app_status.enable_mip_generation = *enable_mip;
478
479 // Enabling mip generation does not trigger a request to regenerate the image.
480}
481
482/// Handles a request from the user to change the image size via the UI.
483fn handle_image_size_setting_change(
484 event: On<ValueChange<Entity>>,
485 new_value_query: Query<&RadioButtonOptionValue<ImageSizeSetting>>,
486 mut app_status: ResMut<AppStatus>,
487 mut regenerate_image_message_writer: MessageWriter<RegenerateImage>,
488) {
489 let Ok(RadioButtonOptionValue(size_setting)) = new_value_query.get(event.value) else {
490 return;
491 };
492
493 match *size_setting {
494 ImageSizeSetting::ImageWidth(image_size) => app_status.image_width = image_size,
495 ImageSizeSetting::ImageHeight(image_size) => app_status.image_height = image_size,
496 }
497
498 // Schedule the image to be regenerated.
499 regenerate_image_message_writer.write(RegenerateImage);
500}
501
502/// Handles resize events for the window.
503///
504/// Resizing the window invalidates the image and repositions all image views.
505/// (Regenerating the image isn't strictly necessary, but it's simplest to have
506/// a single function that both regenerates the image and recreates the image
507/// views.)
508fn handle_window_resize_events(
509 mut events: MessageReader<WindowResized>,
510 mut regenerate_image_message_writer: MessageWriter<RegenerateImage>,
511) {
512 for _ in events.read() {
513 regenerate_image_message_writer.write(RegenerateImage);
514 }
515}- examples/ecs/ecs_guide.rs
- examples/audio/pitch.rs
- examples/ecs/observer_propagation.rs
- examples/showcase/desk_toy.rs
- examples/camera/pan_orbit_camera_cad.rs
- examples/3d/mixed_lighting.rs
- examples/showcase/game_menu.rs
- examples/picking/custom_hit_data.rs
- examples/ui/widgets/feathers_gallery.rs
- examples/input/gamepad_rumble.rs
- examples/ui/render_ui_to_texture.rs
- examples/window/low_power.rs
- examples/camera/pan_orbit_camera_custom_input_plugin.rs
- examples/app/headless_renderer.rs
Sourcepub fn write_batch(
&mut self,
messages: impl IntoIterator<Item = M>,
) -> WriteBatchIds<M> ⓘ
pub fn write_batch( &mut self, messages: impl IntoIterator<Item = M>, ) -> WriteBatchIds<M> ⓘ
Writes a list of messages all at once, which can later be read by MessageReaders.
This is more efficient than writing each message individually.
This method returns the IDs of the written messages.
See Messages for details.
Sourcepub fn write_default(&mut self) -> MessageId<M>where
M: Default,
pub fn write_default(&mut self) -> MessageId<M>where
M: Default,
Writes the default value of the message. Useful when the message is an empty struct.
This method returns the ID of the written message.
See Messages for details.
Examples found in repository?
97fn apply_damage_to_health(
98 mut deal_damage_reader: MessageReader<DealDamage>,
99 mut damaged_received_writer: MessageWriter<DamageReceived>,
100) {
101 for deal_damage in deal_damage_reader.read() {
102 info!("Applying {} damage", deal_damage.amount);
103 if deal_damage.amount > 0 {
104 // Messages with a 'Default' implementation can be written with 'write_default'
105 damaged_received_writer.write_default();
106 }
107 }
108}Trait Implementations§
impl<'w, 's, M> ReadOnlySystemParam for MessageWriter<'w, M>
Source§impl<M> SystemParam for MessageWriter<'_, M>where
M: Message,
impl<M> SystemParam for MessageWriter<'_, M>where
M: Message,
Source§type Item<'w, 's> = MessageWriter<'w, M>
type Item<'w, 's> = MessageWriter<'w, M>
Self, instantiated with new lifetimes. Read moreSource§fn init_state(world: &mut World) -> <MessageWriter<'_, M> as SystemParam>::State
fn init_state(world: &mut World) -> <MessageWriter<'_, M> as SystemParam>::State
State.Source§fn init_access(
state: &<MessageWriter<'_, M> as SystemParam>::State,
system_meta: &mut SystemMeta,
system_access: &mut SystemAccess,
world: &mut World,
)
fn init_access( state: &<MessageWriter<'_, M> as SystemParam>::State, system_meta: &mut SystemMeta, system_access: &mut SystemAccess, world: &mut World, )
Source§fn apply(
state: &mut <MessageWriter<'_, M> as SystemParam>::State,
system_meta: &SystemMeta,
world: &mut World,
)
fn apply( state: &mut <MessageWriter<'_, M> as SystemParam>::State, system_meta: &SystemMeta, world: &mut World, )
SystemParam’s state.
This is used to apply Commands during ApplyDeferred.Source§fn queue(
state: &mut <MessageWriter<'_, M> as SystemParam>::State,
system_meta: &SystemMeta,
world: DeferredWorld<'_>,
)
fn queue( state: &mut <MessageWriter<'_, M> as SystemParam>::State, system_meta: &SystemMeta, world: DeferredWorld<'_>, )
ApplyDeferred.Source§unsafe fn get_param<'w, 's>(
state: &'s mut <MessageWriter<'_, M> as SystemParam>::State,
system_meta: &SystemMeta,
world: UnsafeWorldCell<'w>,
change_tick: Tick,
) -> Result<<MessageWriter<'_, M> as SystemParam>::Item<'w, 's>, SystemParamValidationError>
unsafe fn get_param<'w, 's>( state: &'s mut <MessageWriter<'_, M> as SystemParam>::State, system_meta: &SystemMeta, world: UnsafeWorldCell<'w>, change_tick: Tick, ) -> Result<<MessageWriter<'_, M> as SystemParam>::Item<'w, 's>, SystemParamValidationError>
SystemParamFunction. Read moreAuto Trait Implementations§
impl<'w, M> !UnwindSafe for MessageWriter<'w, M>
impl<'w, M> Freeze for MessageWriter<'w, M>
impl<'w, M> RefUnwindSafe for MessageWriter<'w, M>
impl<'w, M> Send for MessageWriter<'w, M>
impl<'w, M> Sync for MessageWriter<'w, M>
impl<'w, M> Unpin for MessageWriter<'w, M>
impl<'w, M> UnsafeUnpin for MessageWriter<'w, M>
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
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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)
&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)
&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>
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>
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)
&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)
&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>,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
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> ⓘ
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> ⓘ
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>
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<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,
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,
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,
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
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
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
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
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
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
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
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
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
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
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
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
.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
.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
.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
.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
.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
.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
.tap_deref() only in debug builds, and is erased in release
builds.