pub struct Rot2 {
pub cos: f32,
pub sin: f32,
}Expand description
A 2D rotation.
§Example
use std::f32::consts::PI;
// Create rotations from counterclockwise angles in radians or degrees
let rotation1 = Rot2::radians(PI / 2.0);
let rotation2 = Rot2::degrees(45.0);
// Get the angle back as radians or degrees
assert_eq!(rotation1.as_degrees(), 90.0);
assert_eq!(rotation2.as_radians(), PI / 4.0);
// "Add" rotations together using `*`
#[cfg(feature = "approx")]
assert_relative_eq!(rotation1 * rotation2, Rot2::degrees(135.0));
// Rotate vectors
#[cfg(feature = "approx")]
assert_relative_eq!(rotation1 * Vec2::X, Vec2::Y);Fields§
§cos: f32The cosine of the rotation angle.
This is the real part of the unit complex number representing the rotation.
sin: f32The sine of the rotation angle.
This is the imaginary part of the unit complex number representing the rotation.
Implementations§
Source§impl Rot2
impl Rot2
Sourcepub const IDENTITY: Rot2
pub const IDENTITY: Rot2
No rotation. Also equals a full turn that returns back to its original position.
#[cfg(feature = "approx")]
assert_relative_eq!(Rot2::IDENTITY, Rot2::degrees(360.0), epsilon = 2e-7);Sourcepub const FRAC_PI_2: Rot2
pub const FRAC_PI_2: Rot2
A counterclockwise rotation of π/2 radians. Corresponds to a counterclockwise quarter-turn.
Sourcepub const FRAC_PI_3: Rot2
pub const FRAC_PI_3: Rot2
A counterclockwise rotation of π/3 radians. Corresponds to a counterclockwise turn by 60°.
Sourcepub const FRAC_PI_4: Rot2
pub const FRAC_PI_4: Rot2
A counterclockwise rotation of π/4 radians. Corresponds to a counterclockwise turn by 45°.
Sourcepub const FRAC_PI_6: Rot2
pub const FRAC_PI_6: Rot2
A counterclockwise rotation of π/6 radians. Corresponds to a counterclockwise turn by 30°.
Sourcepub const FRAC_PI_8: Rot2
pub const FRAC_PI_8: Rot2
A counterclockwise rotation of π/8 radians. Corresponds to a counterclockwise turn by 22.5°.
Sourcepub fn radians(radians: f32) -> Rot2
pub fn radians(radians: f32) -> Rot2
Creates a Rot2 from a counterclockwise angle in radians.
A negative argument corresponds to a clockwise rotation.
§Note
Angles larger than or equal to 2π (in either direction) loop around to smaller rotations, since a full rotation returns an object to its starting orientation.
§Example
let rot1 = Rot2::radians(3.0 * FRAC_PI_2);
let rot2 = Rot2::radians(-FRAC_PI_2);
#[cfg(feature = "approx")]
assert_relative_eq!(rot1, rot2);
let rot3 = Rot2::radians(PI);
#[cfg(feature = "approx")]
assert_relative_eq!(rot1 * rot1, rot3);
// A rotation by 3π and 1π are the same
#[cfg(feature = "approx")]
assert_relative_eq!(Rot2::radians(3.0 * PI), Rot2::radians(PI));Examples found in repository?
More examples
104fn draw_bounds<Shape: Bounded2d + Send + Sync + 'static>(
105 q: Query<(&DrawBounds<Shape>, &GlobalTransform)>,
106 mut gizmos: Gizmos,
107) {
108 for (shape, transform) in &q {
109 let (_, rotation, translation) = transform.to_scale_rotation_translation();
110 let translation = translation.truncate();
111 let rotation = rotation.to_euler(EulerRot::XYZ).2;
112 let isometry = Isometry2d::new(translation, Rot2::radians(rotation));
113
114 let aabb = shape.0.aabb_2d(isometry);
115 gizmos.rect_2d(aabb.center(), aabb.half_size() * 2.0, RED);
116
117 let bounding_circle = shape.0.bounding_circle(isometry);
118 gizmos.circle_2d(bounding_circle.center, bounding_circle.radius(), BLUE);
119 }
120}101fn render_shapes(mut gizmos: Gizmos, query: Query<(&Shape, &Transform)>) {
102 let color = GRAY;
103 for (shape, transform) in query.iter() {
104 let translation = transform.translation.xy();
105 let rotation = transform.rotation.to_euler(EulerRot::YXZ).2;
106 let isometry = Isometry2d::new(translation, Rot2::radians(rotation));
107 match shape {
108 Shape::Rectangle(r) => {
109 gizmos.primitive_2d(r, isometry, color);
110 }
111 Shape::Circle(c) => {
112 gizmos.primitive_2d(c, isometry, color);
113 }
114 Shape::Triangle(t) => {
115 gizmos.primitive_2d(t, isometry, color);
116 }
117 Shape::Line(l) => {
118 gizmos.primitive_2d(l, isometry, color);
119 }
120 Shape::Capsule(c) => {
121 gizmos.primitive_2d(c, isometry, color);
122 }
123 Shape::Polygon(p) => {
124 gizmos.primitive_2d(p, isometry, color);
125 }
126 }
127 }
128}
129
130#[derive(Component)]
131enum DesiredVolume {
132 Aabb,
133 Circle,
134}
135
136#[derive(Component, Debug)]
137enum CurrentVolume {
138 Aabb(Aabb2d),
139 Circle(BoundingCircle),
140}
141
142fn update_volumes(
143 mut commands: Commands,
144 query: Query<
145 (Entity, &DesiredVolume, &Shape, &Transform),
146 Or<(Changed<DesiredVolume>, Changed<Shape>, Changed<Transform>)>,
147 >,
148) {
149 for (entity, desired_volume, shape, transform) in query.iter() {
150 let translation = transform.translation.xy();
151 let rotation = transform.rotation.to_euler(EulerRot::YXZ).2;
152 let isometry = Isometry2d::new(translation, Rot2::radians(rotation));
153 match desired_volume {
154 DesiredVolume::Aabb => {
155 let aabb = match shape {
156 Shape::Rectangle(r) => r.aabb_2d(isometry),
157 Shape::Circle(c) => c.aabb_2d(isometry),
158 Shape::Triangle(t) => t.aabb_2d(isometry),
159 Shape::Line(l) => l.aabb_2d(isometry),
160 Shape::Capsule(c) => c.aabb_2d(isometry),
161 Shape::Polygon(p) => p.aabb_2d(isometry),
162 };
163 commands.entity(entity).insert(CurrentVolume::Aabb(aabb));
164 }
165 DesiredVolume::Circle => {
166 let circle = match shape {
167 Shape::Rectangle(r) => r.bounding_circle(isometry),
168 Shape::Circle(c) => c.bounding_circle(isometry),
169 Shape::Triangle(t) => t.bounding_circle(isometry),
170 Shape::Line(l) => l.bounding_circle(isometry),
171 Shape::Capsule(c) => c.bounding_circle(isometry),
172 Shape::Polygon(p) => p.bounding_circle(isometry),
173 };
174 commands
175 .entity(entity)
176 .insert(CurrentVolume::Circle(circle));
177 }
178 }
179 }
180}180fn bounding_shapes_2d(
181 shapes: Query<&Transform, With<Shape2d>>,
182 mut gizmos: Gizmos,
183 bounding_shape: Res<State<BoundingShape>>,
184) {
185 for transform in shapes.iter() {
186 // Get the rotation angle from the 3D rotation.
187 let rotation = transform.rotation.to_scaled_axis().z;
188 let rotation = Rot2::radians(rotation);
189 let isometry = Isometry2d::new(transform.translation.xy(), rotation);
190
191 match bounding_shape.get() {
192 BoundingShape::None => (),
193 BoundingShape::BoundingBox => {
194 // Get the AABB of the primitive with the rotation and translation of the mesh.
195 let aabb = HEART.aabb_2d(isometry);
196 gizmos.rect_2d(aabb.center(), aabb.half_size() * 2., WHITE);
197 }
198 BoundingShape::BoundingSphere => {
199 // Get the bounding sphere of the primitive with the rotation and translation of the mesh.
200 let bounding_circle = HEART.bounding_circle(isometry);
201 gizmos
202 .circle_2d(bounding_circle.center(), bounding_circle.radius(), WHITE)
203 .resolution(64);
204 }
205 }
206 }
207}40fn draw_example_collection(
41 mut gizmos: Gizmos,
42 mut my_gizmos: Gizmos<MyRoundGizmos>,
43 time: Res<Time>,
44) {
45 let sin_t_scaled = ops::sin(time.elapsed_secs()) * 50.;
46 gizmos.line_2d(Vec2::Y * -sin_t_scaled, Vec2::splat(-80.), RED);
47 gizmos.ray_2d(Vec2::Y * sin_t_scaled, Vec2::splat(80.), LIME);
48
49 gizmos
50 .grid_2d(
51 Isometry2d::IDENTITY,
52 UVec2::new(16, 9),
53 Vec2::new(80., 80.),
54 // Dark gray
55 LinearRgba::gray(0.05),
56 )
57 .outer_edges();
58
59 // Triangle
60 gizmos.linestrip_gradient_2d([
61 (Vec2::Y * 300., BLUE),
62 (Vec2::new(-255., -155.), RED),
63 (Vec2::new(255., -155.), LIME),
64 (Vec2::Y * 300., BLUE),
65 ]);
66
67 gizmos.rect_2d(Isometry2d::IDENTITY, Vec2::splat(650.), BLACK);
68
69 gizmos.cross_2d(Vec2::new(-160., 120.), 12., FUCHSIA);
70
71 let domain = Interval::EVERYWHERE;
72 let curve = FunctionCurve::new(domain, |t| Vec2::new(t, ops::sin(t / 25.0) * 100.0));
73 let resolution = ((ops::sin(time.elapsed_secs()) + 1.0) * 50.0) as usize;
74 let times_and_colors = (0..=resolution)
75 .map(|n| n as f32 / resolution as f32)
76 .map(|t| (t - 0.5) * 600.0)
77 .map(|t| (t, TEAL.mix(&HOT_PINK, (t + 300.0) / 600.0)));
78 gizmos.curve_gradient_2d(curve, times_and_colors);
79
80 my_gizmos
81 .rounded_rect_2d(Isometry2d::IDENTITY, Vec2::splat(630.), BLACK)
82 .corner_radius(ops::cos(time.elapsed_secs() / 3.) * 100.);
83
84 // Circles have 32 line-segments by default.
85 // You may want to increase this for larger circles.
86 my_gizmos
87 .circle_2d(Isometry2d::IDENTITY, 300., NAVY)
88 .resolution(64);
89
90 my_gizmos.ellipse_2d(
91 Rot2::radians(time.elapsed_secs() % TAU),
92 Vec2::new(100., 200.),
93 YELLOW_GREEN,
94 );
95
96 // Arcs default resolution is linearly interpolated between
97 // 1 and 32, using the arc length as scalar.
98 my_gizmos.arc_2d(
99 Rot2::radians(sin_t_scaled / 10.),
100 FRAC_PI_2,
101 310.,
102 ORANGE_RED,
103 );
104 my_gizmos.arc_2d(Isometry2d::IDENTITY, FRAC_PI_2, 80.0, ORANGE_RED);
105 my_gizmos.long_arc_2d_between(Vec2::ZERO, Vec2::X * 20.0, Vec2::Y * 20.0, ORANGE_RED);
106 my_gizmos.short_arc_2d_between(Vec2::ZERO, Vec2::X * 40.0, Vec2::Y * 40.0, ORANGE_RED);
107
108 gizmos.arrow_2d(
109 Vec2::ZERO,
110 Vec2::from_angle(sin_t_scaled / -10. + PI / 2.) * 50.,
111 YELLOW,
112 );
113
114 // You can create more complex arrows using the arrow builder.
115 gizmos
116 .arrow_2d(
117 Vec2::ZERO,
118 Vec2::from_angle(sin_t_scaled / -10.) * 50.,
119 GREEN,
120 )
121 .with_double_end()
122 .with_tip_length(10.);
123}404fn draw_gizmos_2d(mut gizmos: Gizmos, state: Res<State<PrimitiveSelected>>, time: Res<Time>) {
405 const POSITION: Vec2 = Vec2::new(-LEFT_RIGHT_OFFSET_2D, 0.0);
406 let angle = time.elapsed_secs();
407 let isometry = Isometry2d::new(POSITION, Rot2::radians(angle));
408 let color = Color::WHITE;
409
410 #[expect(
411 clippy::match_same_arms,
412 reason = "Certain primitives don't have any 2D rendering support yet."
413 )]
414 match state.get() {
415 PrimitiveSelected::RectangleAndCuboid => {
416 gizmos.primitive_2d(&RECTANGLE, isometry, color);
417 }
418 PrimitiveSelected::CircleAndSphere => {
419 gizmos.primitive_2d(&CIRCLE, isometry, color);
420 }
421 PrimitiveSelected::Ellipse => drop(gizmos.primitive_2d(&ELLIPSE, isometry, color)),
422 PrimitiveSelected::Triangle => gizmos.primitive_2d(&TRIANGLE_2D, isometry, color),
423 PrimitiveSelected::Plane => gizmos.primitive_2d(&PLANE_2D, isometry, color),
424 PrimitiveSelected::Line => drop(gizmos.primitive_2d(&LINE2D, isometry, color)),
425 PrimitiveSelected::Segment => {
426 drop(gizmos.primitive_2d(&SEGMENT_2D, isometry, color));
427 }
428 PrimitiveSelected::Polyline => gizmos.primitive_2d(
429 &Polyline2d {
430 vertices: vec![
431 Vec2::new(-BIG_2D, -SMALL_2D),
432 Vec2::new(-SMALL_2D, SMALL_2D),
433 Vec2::new(SMALL_2D, -SMALL_2D),
434 Vec2::new(BIG_2D, SMALL_2D),
435 ],
436 },
437 isometry,
438 color,
439 ),
440 PrimitiveSelected::Polygon => gizmos.primitive_2d(
441 &Polygon {
442 vertices: vec![
443 Vec2::new(-BIG_2D, -SMALL_2D),
444 Vec2::new(BIG_2D, -SMALL_2D),
445 Vec2::new(BIG_2D, SMALL_2D),
446 Vec2::new(0.0, 0.0),
447 Vec2::new(-BIG_2D, SMALL_2D),
448 ],
449 },
450 isometry,
451 color,
452 ),
453 PrimitiveSelected::RegularPolygon => {
454 gizmos.primitive_2d(®ULAR_POLYGON, isometry, color);
455 }
456 PrimitiveSelected::Capsule => gizmos.primitive_2d(&CAPSULE_2D, isometry, color),
457 PrimitiveSelected::Cylinder => {}
458 PrimitiveSelected::Cone => {}
459 PrimitiveSelected::ConicalFrustum => {}
460 PrimitiveSelected::Torus => drop(gizmos.primitive_2d(&ANNULUS, isometry, color)),
461 PrimitiveSelected::Tetrahedron => {}
462 PrimitiveSelected::Arc => gizmos.primitive_2d(&ARC, isometry, color),
463 PrimitiveSelected::CircularSector => {
464 gizmos.primitive_2d(&CIRCULAR_SECTOR, isometry, color);
465 }
466 PrimitiveSelected::CircularSegment => {
467 gizmos.primitive_2d(&CIRCULAR_SEGMENT, isometry, color);
468 }
469 }
470}Sourcepub fn degrees(degrees: f32) -> Rot2
pub fn degrees(degrees: f32) -> Rot2
Creates a Rot2 from a counterclockwise angle in degrees.
A negative argument corresponds to a clockwise rotation.
§Note
Angles larger than or equal to 360° (in either direction) loop around to smaller rotations, since a full rotation returns an object to its starting orientation.
§Example
let rot1 = Rot2::degrees(270.0);
let rot2 = Rot2::degrees(-90.0);
#[cfg(feature = "approx")]
assert_relative_eq!(rot1, rot2);
let rot3 = Rot2::degrees(180.0);
#[cfg(feature = "approx")]
assert_relative_eq!(rot1 * rot1, rot3);
// A rotation by 365° and 5° are the same
#[cfg(feature = "approx")]
assert_abs_diff_eq!(Rot2::degrees(365.0), Rot2::degrees(5.0), epsilon = 2e-7);Examples found in repository?
15fn setup(
16 mut commands: Commands,
17 mut meshes: ResMut<Assets<Mesh>>,
18 mut materials: ResMut<Assets<StandardMaterial>>,
19 asset_server: Res<AssetServer>,
20) {
21 let sphere_mesh = meshes.add(Sphere::new(0.45));
22 // add entities to the world
23 for y in -2..=2 {
24 for x in -5..=5 {
25 let x01 = (x + 5) as f32 / 10.0;
26 let y01 = (y + 2) as f32 / 4.0;
27 // sphere
28 commands.spawn((
29 Mesh3d(sphere_mesh.clone()),
30 MeshMaterial3d(materials.add(StandardMaterial {
31 base_color: Srgba::hex("#ffd891").unwrap().into(),
32 // vary key PBR parameters on a grid of spheres to show the effect
33 metallic: y01,
34 perceptual_roughness: x01,
35 ..default()
36 })),
37 Transform::from_xyz(x as f32, y as f32 + 0.5, 0.0),
38 ));
39 }
40 }
41 // unlit sphere
42 commands.spawn((
43 Mesh3d(sphere_mesh),
44 MeshMaterial3d(materials.add(StandardMaterial {
45 base_color: Srgba::hex("#ffd891").unwrap().into(),
46 // vary key PBR parameters on a grid of spheres to show the effect
47 unlit: true,
48 ..default()
49 })),
50 Transform::from_xyz(-5.0, -2.5, 0.0),
51 ));
52
53 commands.spawn((
54 DirectionalLight {
55 illuminance: 1_500.,
56 ..default()
57 },
58 Transform::from_xyz(50.0, 50.0, 50.0).looking_at(Vec3::ZERO, Vec3::Y),
59 ));
60
61 // labels
62 commands.spawn((
63 Text::new("Perceptual Roughness"),
64 TextFont {
65 font_size: 30.0,
66 ..default()
67 },
68 Node {
69 position_type: PositionType::Absolute,
70 top: px(20),
71 left: px(100),
72 ..default()
73 },
74 ));
75
76 commands.spawn((
77 Text::new("Metallic"),
78 TextFont {
79 font_size: 30.0,
80 ..default()
81 },
82 Node {
83 position_type: PositionType::Absolute,
84 top: px(130),
85 right: Val::ZERO,
86 ..default()
87 },
88 UiTransform {
89 rotation: Rot2::degrees(90.),
90 ..default()
91 },
92 ));
93
94 commands.spawn((
95 Text::new("Loading Environment Map..."),
96 TextFont {
97 font_size: 30.0,
98 ..default()
99 },
100 Node {
101 position_type: PositionType::Absolute,
102 bottom: px(20),
103 right: px(20),
104 ..default()
105 },
106 EnvironmentMapLabel,
107 ));
108
109 // camera
110 commands.spawn((
111 Camera3d::default(),
112 Transform::from_xyz(0.0, 0.0, 8.0).looking_at(Vec3::default(), Vec3::Y),
113 Projection::from(OrthographicProjection {
114 scale: 0.01,
115 scaling_mode: ScalingMode::WindowSize,
116 ..OrthographicProjection::default_3d()
117 }),
118 EnvironmentMapLight {
119 diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
120 specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
121 intensity: 900.0,
122 ..default()
123 },
124 ));
125}Sourcepub fn turn_fraction(fraction: f32) -> Rot2
pub fn turn_fraction(fraction: f32) -> Rot2
Creates a Rot2 from a counterclockwise fraction of a full turn of 360 degrees.
A negative argument corresponds to a clockwise rotation.
§Note
Angles larger than or equal to 1 turn (in either direction) loop around to smaller rotations, since a full rotation returns an object to its starting orientation.
§Example
let rot1 = Rot2::turn_fraction(0.75);
let rot2 = Rot2::turn_fraction(-0.25);
#[cfg(feature = "approx")]
assert_relative_eq!(rot1, rot2);
let rot3 = Rot2::turn_fraction(0.5);
#[cfg(feature = "approx")]
assert_relative_eq!(rot1 * rot1, rot3);
// A rotation by 1.5 turns and 0.5 turns are the same
#[cfg(feature = "approx")]
assert_relative_eq!(Rot2::turn_fraction(1.5), Rot2::turn_fraction(0.5));Sourcepub fn from_sin_cos(sin: f32, cos: f32) -> Rot2
pub fn from_sin_cos(sin: f32, cos: f32) -> Rot2
Sourcepub fn as_radians(self) -> f32
pub fn as_radians(self) -> f32
Returns a corresponding rotation angle in radians in the (-pi, pi] range.
Sourcepub fn as_degrees(self) -> f32
pub fn as_degrees(self) -> f32
Returns a corresponding rotation angle in degrees in the (-180, 180] range.
Sourcepub fn as_turn_fraction(self) -> f32
pub fn as_turn_fraction(self) -> f32
Returns a corresponding rotation angle as a fraction of a full 360 degree turn in the (-0.5, 0.5] range.
Sourcepub fn length(self) -> f32
pub fn length(self) -> f32
Computes the length or norm of the complex number used to represent the rotation.
The length is typically expected to be 1.0. Unexpectedly denormalized rotations
can be a result of incorrect construction or floating point error caused by
successive operations.
Sourcepub fn length_squared(self) -> f32
pub fn length_squared(self) -> f32
Computes the squared length or norm of the complex number used to represent the rotation.
This is generally faster than Rot2::length(), as it avoids a square
root operation.
The length is typically expected to be 1.0. Unexpectedly denormalized rotations
can be a result of incorrect construction or floating point error caused by
successive operations.
Sourcepub fn length_recip(self) -> f32
pub fn length_recip(self) -> f32
Computes 1.0 / self.length().
For valid results, self must not have a length of zero.
Sourcepub fn try_normalize(self) -> Option<Rot2>
pub fn try_normalize(self) -> Option<Rot2>
Returns self with a length of 1.0 if possible, and None otherwise.
None will be returned if the sine and cosine of self are both zero (or very close to zero),
or if either of them is NaN or infinite.
Note that Rot2 should typically already be normalized by design.
Manual normalization is only needed when successive operations result in
accumulated floating point error, or if the rotation was constructed
with invalid values.
Sourcepub fn normalize(self) -> Rot2
pub fn normalize(self) -> Rot2
Returns self with a length of 1.0.
Note that Rot2 should typically already be normalized by design.
Manual normalization is only needed when successive operations result in
accumulated floating point error, or if the rotation was constructed
with invalid values.
§Panics
Panics if self has a length of zero, NaN, or infinity when debug assertions are enabled.
Sourcepub fn fast_renormalize(self) -> Rot2
pub fn fast_renormalize(self) -> Rot2
Returns self after an approximate normalization, assuming the value is already nearly normalized.
Useful for preventing numerical error accumulation.
See Dir3::fast_renormalize for an example of when such error accumulation might occur.
Sourcepub fn is_normalized(self) -> bool
pub fn is_normalized(self) -> bool
Returns whether self has a length of 1.0 or not.
Uses a precision threshold of approximately 1e-4.
Sourcepub fn is_near_identity(self) -> bool
pub fn is_near_identity(self) -> bool
Returns true if the rotation is near Rot2::IDENTITY.
Sourcepub fn angle_to(self, other: Rot2) -> f32
pub fn angle_to(self, other: Rot2) -> f32
Returns the angle in radians needed to make self and other coincide.
Sourcepub const fn inverse(self) -> Rot2
pub const fn inverse(self) -> Rot2
Returns the inverse of the rotation. This is also the conjugate of the unit complex number representing the rotation.
Sourcepub fn nlerp(self, end: Rot2, s: f32) -> Rot2
pub fn nlerp(self, end: Rot2, s: f32) -> Rot2
Performs a linear interpolation between self and rhs based on
the value s, and normalizes the rotation afterwards.
When s == 0.0, the result will be equal to self.
When s == 1.0, the result will be equal to rhs.
This is slightly more efficient than slerp, and produces a similar result
when the difference between the two rotations is small. At larger differences,
the result resembles a kind of ease-in-out effect.
If you would like the angular velocity to remain constant, consider using slerp instead.
§Details
nlerp corresponds to computing an angle for a point at position s on a line drawn
between the endpoints of the arc formed by self and rhs on a unit circle,
and normalizing the result afterwards.
Note that if the angles are opposite like 0 and π, the line will pass through the origin,
and the resulting angle will always be either self or rhs depending on s.
If s happens to be 0.5 in this case, a valid rotation cannot be computed, and self
will be returned as a fallback.
§Example
let rot1 = Rot2::IDENTITY;
let rot2 = Rot2::degrees(135.0);
let result1 = rot1.nlerp(rot2, 1.0 / 3.0);
assert_eq!(result1.as_degrees(), 28.675055);
let result2 = rot1.nlerp(rot2, 0.5);
assert_eq!(result2.as_degrees(), 67.5);Sourcepub fn slerp(self, end: Rot2, s: f32) -> Rot2
pub fn slerp(self, end: Rot2, s: f32) -> Rot2
Performs a spherical linear interpolation between self and end
based on the value s.
This corresponds to interpolating between the two angles at a constant angular velocity.
When s == 0.0, the result will be equal to self.
When s == 1.0, the result will be equal to rhs.
If you would like the rotation to have a kind of ease-in-out effect, consider
using the slightly more efficient nlerp instead.
§Example
let rot1 = Rot2::IDENTITY;
let rot2 = Rot2::degrees(135.0);
let result1 = rot1.slerp(rot2, 1.0 / 3.0);
assert_eq!(result1.as_degrees(), 45.0);
let result2 = rot1.slerp(rot2, 0.5);
assert_eq!(result2.as_degrees(), 67.5);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rot2
impl<'de> Deserialize<'de> for Rot2
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Rot2, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Rot2, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Ease for Rot2
impl Ease for Rot2
Source§impl From<Rot2> for Isometry2d
impl From<Rot2> for Isometry2d
Source§fn from(rotation: Rot2) -> Isometry2d
fn from(rotation: Rot2) -> Isometry2d
Source§impl FromReflect for Rot2
impl FromReflect for Rot2
Source§fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Rot2>
fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Rot2>
Self from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn PartialReflect>,
) -> Result<Self, Box<dyn PartialReflect>>
fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>
Self using,
constructing the value using from_reflect if that fails. Read moreSource§impl GetTypeRegistration for Rot2
impl GetTypeRegistration for Rot2
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
TypeRegistration for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Source§impl IntoReturn for Rot2
impl IntoReturn for Rot2
Source§impl MulAssign for Rot2
impl MulAssign for Rot2
Source§fn mul_assign(&mut self, rhs: Rot2)
fn mul_assign(&mut self, rhs: Rot2)
*= operation. Read moreSource§impl PartialReflect for Rot2
impl PartialReflect for Rot2
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn try_apply(
&mut self,
value: &(dyn PartialReflect + 'static),
) -> Result<(), ApplyError>
fn try_apply( &mut self, value: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Source§fn reflect_owned(self: Box<Rot2>) -> ReflectOwned
fn reflect_owned(self: Box<Rot2>) -> ReflectOwned
Source§fn try_into_reflect(
self: Box<Rot2>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<Rot2>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
Source§fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
Source§fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
Source§fn into_partial_reflect(self: Box<Rot2>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<Rot2>) -> Box<dyn PartialReflect>
Source§fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
Source§fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
Source§fn reflect_partial_eq(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<bool>
fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
Self using reflection. Read moreSource§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Source§fn to_dynamic(&self) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
Source§fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
PartialReflect, combines reflect_clone and
take in a useful fashion, automatically constructing an appropriate
ReflectCloneError if the downcast fails. Read moreSource§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Source§impl Reflect for Rot2
impl Reflect for Rot2
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any. Read moreSource§fn into_reflect(self: Box<Rot2>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Rot2>) -> Box<dyn Reflect>
Source§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
Source§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
Source§impl Serialize for Rot2
impl Serialize for Rot2
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl StableInterpolate for Rot2
impl StableInterpolate for Rot2
Source§fn interpolate_stable(&self, other: &Rot2, t: f32) -> Rot2
fn interpolate_stable(&self, other: &Rot2, t: f32) -> Rot2
other given value using the parameter t. At
t = 0.0, a value equivalent to self is recovered, while t = 1.0 recovers a value
equivalent to other, with intermediate values interpolating between the two.
See the trait-level documentation for details.Source§fn interpolate_stable_assign(&mut self, other: &Self, t: f32)
fn interpolate_stable_assign(&mut self, other: &Self, t: f32)
interpolate_stable that assigns the result to self for convenience.Source§fn smooth_nudge(&mut self, target: &Self, decay_rate: f32, delta: f32)
fn smooth_nudge(&mut self, target: &Self, decay_rate: f32, delta: f32)
target at a given decay rate. The decay_rate
parameter controls how fast the distance between self and target decays relative to
the units of delta; the intended usage is for decay_rate to generally remain fixed,
while delta is something like delta_time from an updating system. This produces a
smooth following of the target that is independent of framerate. Read moreSource§impl Struct for Rot2
impl Struct for Rot2
Source§fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
name as a &dyn PartialReflect.Source§fn field_mut(
&mut self,
name: &str,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_mut( &mut self, name: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>
name as a
&mut dyn PartialReflect.Source§fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
index as a
&dyn PartialReflect.Source§fn field_at_mut(
&mut self,
index: usize,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_at_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>
index
as a &mut dyn PartialReflect.Source§fn name_at(&self, index: usize) -> Option<&str>
fn name_at(&self, index: usize) -> Option<&str>
index.Source§fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn iter_fields(&self) -> FieldIter<'_> ⓘ
Source§fn to_dynamic_struct(&self) -> DynamicStruct
fn to_dynamic_struct(&self) -> DynamicStruct
DynamicStruct from this struct.Source§fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
None if TypeInfo is not available.Source§impl TypePath for Rot2
impl TypePath for Rot2
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
impl Copy for Rot2
impl StructuralPartialEq for Rot2
Auto Trait Implementations§
impl Freeze for Rot2
impl RefUnwindSafe for Rot2
impl Send for Rot2
impl Sync for Rot2
impl Unpin for Rot2
impl UnwindSafe for Rot2
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<T> DynamicTyped for Twhere
T: Typed,
impl<T> DynamicTyped for Twhere
T: Typed,
Source§fn reflect_type_info(&self) -> &'static TypeInfo
fn reflect_type_info(&self) -> &'static TypeInfo
Typed::type_info.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> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
Source§impl<T> GetPath for T
impl<T> GetPath for T
Source§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
path. Read moreSource§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
path. Read moreSource§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.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
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.