pub struct Dir3(/* private fields */);Expand description
A normalized vector pointing in a direction in 3D space
Implementations§
Source§impl Dir3
impl Dir3
Sourcepub const ALL_VERTICES: [Dir3; 8]
pub const ALL_VERTICES: [Dir3; 8]
The directions pointing towards the vertices of a cube centered at the origin.
Sourcepub const ALL_NEIGHBORS: [Dir3; 26]
pub const ALL_NEIGHBORS: [Dir3; 26]
All neighbors of a tile on a cube grid a 3x3x3 neighborhood. A combination of Self::CARDINALS, Self::ALL_EDGES and Self::ALL_VERTICES
Sourcepub fn new(value: Vec3) -> Result<Dir3, InvalidDirectionError>
pub fn new(value: Vec3) -> Result<Dir3, InvalidDirectionError>
Create a direction from a finite, nonzero Vec3, normalizing it.
Returns Err(InvalidDirectionError) if the length
of the given vector is zero (or very close to zero), infinite, or NaN.
Examples found in repository?
23fn bouncing_raycast(
24 mut ray_cast: MeshRayCast,
25 mut gizmos: Gizmos,
26 time: Res<Time>,
27 // The ray map stores rays cast by the cursor
28 ray_map: Res<RayMap>,
29) {
30 // Cast an automatically moving ray and bounce it off of surfaces
31 let t = ops::cos((time.elapsed_secs() - 4.0).max(0.0) * LASER_SPEED) * PI;
32 let ray_pos = Vec3::new(ops::sin(t), ops::cos(3.0 * t) * 0.5, ops::cos(t)) * 0.5;
33 let ray_dir = Dir3::new(-ray_pos).unwrap();
34 let ray = Ray3d::new(ray_pos, ray_dir);
35 gizmos.sphere(ray_pos, 0.1, Color::WHITE);
36 bounce_ray(ray, &mut ray_cast, &mut gizmos, Color::from(css::RED));
37
38 // Cast a ray from the cursor and bounce it off of surfaces
39 for (_, ray) in ray_map.iter() {
40 bounce_ray(*ray, &mut ray_cast, &mut gizmos, Color::from(css::GREEN));
41 }
42}
43
44// Bounces a ray off of surfaces `MAX_BOUNCES` times.
45fn bounce_ray(mut ray: Ray3d, ray_cast: &mut MeshRayCast, gizmos: &mut Gizmos, color: Color) {
46 let mut intersections = Vec::with_capacity(MAX_BOUNCES + 1);
47 intersections.push((ray.origin, Color::srgb(30.0, 0.0, 0.0)));
48
49 for i in 0..MAX_BOUNCES {
50 // Cast the ray and get the first hit
51 let Some((_, hit)) = ray_cast
52 .cast_ray(ray, &MeshRayCastSettings::default())
53 .first()
54 else {
55 break;
56 };
57
58 // Draw the point of intersection and add it to the list
59 let brightness = 1.0 + 10.0 * (1.0 - i as f32 / MAX_BOUNCES as f32);
60 intersections.push((hit.point, Color::BLACK.mix(&color, brightness)));
61 gizmos.sphere(hit.point, 0.005, Color::BLACK.mix(&color, brightness * 2.0));
62
63 // Reflect the ray off of the surface
64 ray.direction = Dir3::new(ray.direction.reflect(hit.normal)).unwrap();
65 ray.origin = hit.point + ray.direction * 1e-6;
66 }
67 gizmos.linestrip_gradient(intersections);
68}More examples
92fn move_target(
93 mut target: Single<&mut Transform, With<TargetSphere>>,
94 target_speed: Res<TargetSphereSpeed>,
95 mut target_pos: ResMut<TargetPosition>,
96 time: Res<Time>,
97 mut rng: ResMut<RandomSource>,
98) {
99 match Dir3::new(target_pos.0 - target.translation) {
100 // The target and the present position of the target sphere are far enough to have a well-
101 // defined direction between them, so let's move closer:
102 Ok(dir) => {
103 let delta_time = time.delta_secs();
104 let abs_delta = (target_pos.0 - target.translation).norm();
105
106 // Avoid overshooting in case of high values of `delta_time`:
107 let magnitude = f32::min(abs_delta, delta_time * target_speed.0);
108 target.translation += dir * magnitude;
109 }
110
111 // The two are really close, so let's generate a new target position:
112 Err(_) => {
113 let legal_region = Cuboid::from_size(Vec3::splat(4.0));
114 *target_pos = TargetPosition(legal_region.sample_interior(&mut rng.0));
115 }
116 }
117}13fn setup(
14 mut commands: Commands,
15 asset_server: Res<AssetServer>,
16 mut materials: ResMut<Assets<StandardMaterial>>,
17 meshes: Res<Assets<Mesh>>,
18) {
19 commands.spawn((Camera3d::default(), Transform::from_xyz(0.0, 0.0, 5.0)));
20
21 commands.spawn((
22 DirectionalLight::default(),
23 Transform::default().looking_to(Dir3::new(Vec3::new(-1.0, -1.0, -1.0)).unwrap(), Dir3::Y),
24 ));
25
26 // The simplest way to generate an asset is to add it directly to the `Assets`.
27 let material_handle = materials.add(StandardMaterial::default());
28
29 commands.spawn((
30 Transform::from_xyz(-2.0, 0.0, 0.0),
31 MeshMaterial3d(material_handle.clone()),
32 // Alternatively, `add_async` creates a task that runs your async function. Once it
33 // completes, the asset is added to the `Assets`. This is "deferred" meaning that the asset
34 // may take a frame to be added after the task completes.
35 Mesh3d(asset_server.add_async(generate_mesh_async())),
36 ));
37
38 // The last way to generate assets is to reserve a handle, and then use `Assets::insert` to
39 // populate the asset later. In this example, the `generate_mesh_system` system runs to populate
40 // the mesh.
41 let mesh_handle = meshes.reserve_handle();
42 commands.insert_resource(HandleToGenerate(mesh_handle.clone()));
43 commands.spawn((
44 Transform::from_xyz(2.0, 0.0, 0.0)
45 .with_rotation(Quat::from_rotation_x(50.0f32.to_radians())),
46 Mesh3d(mesh_handle),
47 MeshMaterial3d(material_handle),
48 ));
49}Sourcepub fn new_unchecked(value: Vec3) -> Dir3
pub fn new_unchecked(value: Vec3) -> Dir3
Sourcepub fn new_and_length(value: Vec3) -> Result<(Dir3, f32), InvalidDirectionError>
pub fn new_and_length(value: Vec3) -> Result<(Dir3, f32), InvalidDirectionError>
Create a direction from a finite, nonzero Vec3, normalizing it and
also returning its original length.
Returns Err(InvalidDirectionError) if the length
of the given vector is zero (or very close to zero), infinite, or NaN.
Sourcepub fn from_xyz(x: f32, y: f32, z: f32) -> Result<Dir3, InvalidDirectionError>
pub fn from_xyz(x: f32, y: f32, z: f32) -> Result<Dir3, InvalidDirectionError>
Create a direction from its x, y, and z components.
Returns Err(InvalidDirectionError) if the length
of the vector formed by the components is zero (or very close to zero), infinite, or NaN.
Sourcepub fn from_xyz_unchecked(x: f32, y: f32, z: f32) -> Dir3
pub fn from_xyz_unchecked(x: f32, y: f32, z: f32) -> Dir3
Create a direction from its x, y, and z components, assuming the resulting vector is normalized.
§Warning
The vector produced from x, y, and z must be normalized, i.e its length must be 1.0.
Sourcepub const fn as_vec3(&self) -> Vec3
pub const fn as_vec3(&self) -> Vec3
Returns the inner Vec3
Examples found in repository?
13fn draw_cursor(
14 camera_query: Single<(&Camera, &GlobalTransform)>,
15 ground: Single<&GlobalTransform, With<Ground>>,
16 window: Single<&Window>,
17 mut gizmos: Gizmos,
18) {
19 let (camera, camera_transform) = *camera_query;
20
21 if let Some(cursor_position) = window.cursor_position()
22 // Calculate a ray pointing from the camera into the world based on the cursor's position.
23 && let Ok(ray) = camera.viewport_to_world(camera_transform, cursor_position)
24 // Calculate if and where the ray is hitting the ground plane.
25 && let Some(point) = ray.plane_intersection_point(ground.translation(), InfinitePlane3d::new(ground.up()))
26 {
27 // Draw a circle just above the ground plane at that position.
28 gizmos.circle(
29 Isometry3d::new(
30 point + ground.up() * 0.01,
31 Quat::from_rotation_arc(Vec3::Z, ground.up().as_vec3()),
32 ),
33 0.2,
34 Color::WHITE,
35 );
36 }
37}More examples
634fn move_camera(
635 keyboard_input: Res<ButtonInput<KeyCode>>,
636 mut mouse_wheel_reader: MessageReader<MouseWheel>,
637 mut cameras: Query<&mut Transform, With<Camera>>,
638) {
639 let (mut distance_delta, mut theta_delta) = (0.0, 0.0);
640
641 // Handle keyboard events.
642 if keyboard_input.pressed(KeyCode::KeyW) {
643 distance_delta -= CAMERA_KEYBOARD_ZOOM_SPEED;
644 }
645 if keyboard_input.pressed(KeyCode::KeyS) {
646 distance_delta += CAMERA_KEYBOARD_ZOOM_SPEED;
647 }
648 if keyboard_input.pressed(KeyCode::KeyA) {
649 theta_delta += CAMERA_KEYBOARD_ORBIT_SPEED;
650 }
651 if keyboard_input.pressed(KeyCode::KeyD) {
652 theta_delta -= CAMERA_KEYBOARD_ORBIT_SPEED;
653 }
654
655 // Handle mouse events.
656 for mouse_wheel in mouse_wheel_reader.read() {
657 distance_delta -= mouse_wheel.y * CAMERA_MOUSE_WHEEL_ZOOM_SPEED;
658 }
659
660 // Update transforms.
661 for mut camera_transform in cameras.iter_mut() {
662 let local_z = camera_transform.local_z().as_vec3().normalize_or_zero();
663 if distance_delta != 0.0 {
664 camera_transform.translation = (camera_transform.translation.length() + distance_delta)
665 .clamp(CAMERA_ZOOM_RANGE.start, CAMERA_ZOOM_RANGE.end)
666 * local_z;
667 }
668 if theta_delta != 0.0 {
669 camera_transform
670 .translate_around(Vec3::ZERO, Quat::from_axis_angle(Vec3::Y, theta_delta));
671 camera_transform.look_at(Vec3::ZERO, Vec3::Y);
672 }
673 }
674}Sourcepub fn slerp(self, rhs: Dir3, s: f32) -> Dir3
pub fn slerp(self, rhs: Dir3, s: f32) -> Dir3
Performs a spherical linear interpolation between self and rhs
based on the value s.
This corresponds to interpolating between the two directions 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.
§Example
let dir1 = Dir3::X;
let dir2 = Dir3::Y;
let result1 = dir1.slerp(dir2, 1.0 / 3.0);
#[cfg(feature = "approx")]
assert_relative_eq!(
result1,
Dir3::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(),
epsilon = 0.000001
);
let result2 = dir1.slerp(dir2, 0.5);
#[cfg(feature = "approx")]
assert_relative_eq!(result2, Dir3::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap());Sourcepub fn fast_renormalize(self) -> Dir3
pub fn fast_renormalize(self) -> Dir3
Returns self after an approximate normalization, assuming the value is already nearly normalized.
Useful for preventing numerical error accumulation.
§Example
The following seemingly benign code would start accumulating errors over time,
leading to dir eventually not being normalized anymore.
let mut dir = Dir3::X;
let quaternion = Quat::from_euler(EulerRot::XYZ, 1.0, 2.0, 3.0);
for i in 0..N {
dir = quaternion * dir;
}Instead, do the following.
let mut dir = Dir3::X;
let quaternion = Quat::from_euler(EulerRot::XYZ, 1.0, 2.0, 3.0);
for i in 0..N {
dir = quaternion * dir;
dir = dir.fast_renormalize();
}Methods from Deref<Target = Vec3>§
pub const ZERO: Vec3
pub const ONE: Vec3
pub const NEG_ONE: Vec3
pub const MIN: Vec3
pub const MAX: Vec3
pub const NAN: Vec3
pub const INFINITY: Vec3
pub const NEG_INFINITY: Vec3
pub const X: Vec3
pub const Y: Vec3
pub const Z: Vec3
pub const NEG_X: Vec3
pub const NEG_Y: Vec3
pub const NEG_Z: Vec3
pub const AXES: [Vec3; 3]
pub const USES_CORE_SIMD: bool = false
pub const USES_NEON: bool = false
pub const USES_SCALAR_MATH: bool = true
pub const USES_SSE2: bool = false
pub const USES_WASM_SIMD: bool = false
pub const USES_WASM32_SIMD: bool = false
Trait Implementations§
impl Copy for Dir3
Source§impl<'de> Deserialize<'de> for Dir3
impl<'de> Deserialize<'de> for Dir3
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Dir3, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Dir3, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Ease for Dir3
impl Ease for Dir3
Source§impl FromReflect for Dir3
impl FromReflect for Dir3
Source§fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Dir3>
fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Dir3>
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 Dir3
impl GetTypeRegistration for Dir3
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<Config, Clear> GizmoPrimitive3d<Dir3> for GizmoBuffer<Config, Clear>
impl<Config, Clear> GizmoPrimitive3d<Dir3> for GizmoBuffer<Config, Clear>
Source§type Output<'a> = ()
where
GizmoBuffer<Config, Clear>: 'a
type Output<'a> = () where GizmoBuffer<Config, Clear>: 'a
primitive_3d. This is a builder to set non-default values.Source§fn primitive_3d(
&mut self,
primitive: &Dir3,
isometry: impl Into<Isometry3d>,
color: impl Into<Color>,
) -> <GizmoBuffer<Config, Clear> as GizmoPrimitive3d<Dir3>>::Output<'_>
fn primitive_3d( &mut self, primitive: &Dir3, isometry: impl Into<Isometry3d>, color: impl Into<Color>, ) -> <GizmoBuffer<Config, Clear> as GizmoPrimitive3d<Dir3>>::Output<'_>
Source§impl IntoReturn for Dir3
impl IntoReturn for Dir3
Source§impl Mul<Dir3> for Isometry3d
impl Mul<Dir3> for Isometry3d
Source§impl PartialReflect for Dir3
impl PartialReflect for Dir3
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<Dir3>) -> ReflectOwned
fn reflect_owned(self: Box<Dir3>) -> ReflectOwned
Source§fn try_into_reflect(
self: Box<Dir3>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<Dir3>, ) -> 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<Dir3>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<Dir3>) -> 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 reflect_partial_cmp(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<Ordering>
fn reflect_partial_cmp( &self, value: &(dyn PartialReflect + 'static), ) -> Option<Ordering>
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.Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
impl Primitive3d for Dir3
Source§impl Reflect for Dir3
impl Reflect for Dir3
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<Dir3>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Dir3>) -> 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 Dir3
impl Serialize for Dir3
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 Dir3
impl StableInterpolate for Dir3
Source§fn interpolate_stable(&self, other: &Dir3, t: f32) -> Dir3
fn interpolate_stable(&self, other: &Dir3, t: f32) -> Dir3
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 moreimpl StructuralPartialEq for Dir3
Source§impl TupleStruct for Dir3
impl TupleStruct for Dir3
Source§fn field(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
fn field(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
index as a
&dyn Reflect.Source§fn field_mut(
&mut self,
index: usize,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>
index
as a &mut dyn Reflect.Source§fn iter_fields(&self) -> TupleStructFieldIter<'_> ⓘ
fn iter_fields(&self) -> TupleStructFieldIter<'_> ⓘ
Source§fn to_dynamic_tuple_struct(&self) -> DynamicTupleStruct
fn to_dynamic_tuple_struct(&self) -> DynamicTupleStruct
DynamicTupleStruct from this tuple struct.Source§fn get_represented_tuple_struct_info(&self) -> Option<&'static TupleStructInfo>
fn get_represented_tuple_struct_info(&self) -> Option<&'static TupleStructInfo>
None if TypeInfo is not available.Source§impl TypePath for Dir3
impl TypePath for Dir3
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>
Auto Trait Implementations§
impl Freeze for Dir3
impl RefUnwindSafe for Dir3
impl Send for Dir3
impl Sync for Dir3
impl Unpin for Dir3
impl UnsafeUnpin for Dir3
impl UnwindSafe for Dir3
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>,
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.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> 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<S> GetTupleStructField for Swhere
S: TupleStruct,
impl<S> GetTupleStructField for Swhere
S: TupleStruct,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T> HitDataExtra for T
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
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> Reflectable for T
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>
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.