Struct Cuboid

Source
pub struct Cuboid {
    pub half_size: Vec3,
}
Expand description

A cuboid primitive, which is like a cube, except that the x, y, and z dimensions are not required to be the same.

Fields§

§half_size: Vec3

Half of the width, height and depth of the cuboid

Implementations§

Source§

impl Cuboid

Source

pub fn new(x_length: f32, y_length: f32, z_length: f32) -> Cuboid

Create a new Cuboid from a full x, y, and z length

Examples found in repository?
examples/async_tasks/async_compute.rs (line 38)
33fn add_assets(
34    mut commands: Commands,
35    mut meshes: ResMut<Assets<Mesh>>,
36    mut materials: ResMut<Assets<StandardMaterial>>,
37) {
38    let box_mesh_handle = meshes.add(Cuboid::new(0.25, 0.25, 0.25));
39    commands.insert_resource(BoxMeshHandle(box_mesh_handle));
40
41    let box_material_handle = materials.add(Color::srgb(1.0, 0.2, 0.3));
42    commands.insert_resource(BoxMaterialHandle(box_material_handle));
43}
More examples
Hide additional examples
examples/3d/ssr.rs (line 150)
142fn spawn_cube(
143    commands: &mut Commands,
144    asset_server: &AssetServer,
145    meshes: &mut Assets<Mesh>,
146    standard_materials: &mut Assets<StandardMaterial>,
147) {
148    commands
149        .spawn((
150            Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
151            MeshMaterial3d(standard_materials.add(StandardMaterial {
152                base_color: Color::from(WHITE),
153                base_color_texture: Some(asset_server.load("branding/icon.png")),
154                ..default()
155            })),
156            Transform::from_xyz(0.0, 0.5, 0.0),
157        ))
158        .insert(CubeModel);
159}
examples/picking/debug_picking.rs (line 95)
86fn on_click_spawn_cube(
87    _click: Trigger<Pointer<Click>>,
88    mut commands: Commands,
89    mut meshes: ResMut<Assets<Mesh>>,
90    mut materials: ResMut<Assets<StandardMaterial>>,
91    mut num: Local<usize>,
92) {
93    commands
94        .spawn((
95            Mesh3d(meshes.add(Cuboid::new(0.5, 0.5, 0.5))),
96            MeshMaterial3d(materials.add(Color::srgb_u8(124, 144, 255))),
97            Transform::from_xyz(0.0, 0.25 + 0.55 * *num as f32, 0.0),
98        ))
99        // With the MeshPickingPlugin added, you can add pointer event observers to meshes:
100        .observe(on_drag_rotate);
101    *num += 1;
102}
examples/picking/simple_picking.rs (line 73)
64fn on_click_spawn_cube(
65    _click: Trigger<Pointer<Click>>,
66    mut commands: Commands,
67    mut meshes: ResMut<Assets<Mesh>>,
68    mut materials: ResMut<Assets<StandardMaterial>>,
69    mut num: Local<usize>,
70) {
71    commands
72        .spawn((
73            Mesh3d(meshes.add(Cuboid::new(0.5, 0.5, 0.5))),
74            MeshMaterial3d(materials.add(Color::srgb_u8(124, 144, 255))),
75            Transform::from_xyz(0.0, 0.25 + 0.55 * *num as f32, 0.0),
76        ))
77        // With the MeshPickingPlugin added, you can add pointer event observers to meshes:
78        .observe(on_drag_rotate);
79    *num += 1;
80}
examples/3d/clustered_decals.rs (line 191)
181fn spawn_cube(
182    commands: &mut Commands,
183    meshes: &mut Assets<Mesh>,
184    materials: &mut Assets<ExtendedMaterial<StandardMaterial, CustomDecalExtension>>,
185) {
186    // Rotate the cube a bit just to make it more interesting.
187    let mut transform = Transform::IDENTITY;
188    transform.rotate_y(FRAC_PI_3);
189
190    commands.spawn((
191        Mesh3d(meshes.add(Cuboid::new(3.0, 3.0, 3.0))),
192        MeshMaterial3d(materials.add(ExtendedMaterial {
193            base: StandardMaterial {
194                base_color: SILVER.into(),
195                ..default()
196            },
197            extension: CustomDecalExtension {},
198        })),
199        transform,
200    ));
201}
examples/3d/3d_scene.rs (line 26)
13fn setup(
14    mut commands: Commands,
15    mut meshes: ResMut<Assets<Mesh>>,
16    mut materials: ResMut<Assets<StandardMaterial>>,
17) {
18    // circular base
19    commands.spawn((
20        Mesh3d(meshes.add(Circle::new(4.0))),
21        MeshMaterial3d(materials.add(Color::WHITE)),
22        Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
23    ));
24    // cube
25    commands.spawn((
26        Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
27        MeshMaterial3d(materials.add(Color::srgb_u8(124, 144, 255))),
28        Transform::from_xyz(0.0, 0.5, 0.0),
29    ));
30    // light
31    commands.spawn((
32        PointLight {
33            shadows_enabled: true,
34            ..default()
35        },
36        Transform::from_xyz(4.0, 8.0, 4.0),
37    ));
38    // camera
39    commands.spawn((
40        Camera3d::default(),
41        Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
42    ));
43}
Source

pub fn from_size(size: Vec3) -> Cuboid

Create a new Cuboid from a given full size

Examples found in repository?
examples/math/custom_primitives.rs (line 234)
221fn bounding_shapes_3d(
222    shapes: Query<&Transform, With<Shape3d>>,
223    mut gizmos: Gizmos,
224    bounding_shape: Res<State<BoundingShape>>,
225) {
226    for transform in shapes.iter() {
227        match bounding_shape.get() {
228            BoundingShape::None => (),
229            BoundingShape::BoundingBox => {
230                // Get the AABB of the extrusion with the rotation and translation of the mesh.
231                let aabb = EXTRUSION.aabb_3d(transform.to_isometry());
232
233                gizmos.primitive_3d(
234                    &Cuboid::from_size(Vec3::from(aabb.half_size()) * 2.),
235                    aabb.center(),
236                    WHITE,
237                );
238            }
239            BoundingShape::BoundingSphere => {
240                // Get the bounding sphere of the extrusion with the rotation and translation of the mesh.
241                let bounding_sphere = EXTRUSION.bounding_sphere(transform.to_isometry());
242
243                gizmos.sphere(bounding_sphere.center(), bounding_sphere.radius(), WHITE);
244            }
245        }
246    }
247}
More examples
Hide additional examples
examples/movement/smooth_follow.rs (line 113)
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}
examples/stress_tests/many_materials.rs (line 76)
46fn setup(
47    mut commands: Commands,
48    args: Res<Args>,
49    mesh_assets: ResMut<Assets<Mesh>>,
50    material_assets: ResMut<Assets<StandardMaterial>>,
51) {
52    let args = args.into_inner();
53    let material_assets = material_assets.into_inner();
54    let mesh_assets = mesh_assets.into_inner();
55    let n = args.grid_size;
56
57    // Camera
58    let w = n as f32;
59    commands.spawn((
60        Camera3d::default(),
61        Transform::from_xyz(w * 1.25, w + 1.0, w * 1.25)
62            .looking_at(Vec3::new(0.0, (w * -1.1) + 1.0, 0.0), Vec3::Y),
63    ));
64
65    // Light
66    commands.spawn((
67        Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
68        DirectionalLight {
69            illuminance: 3000.0,
70            shadows_enabled: true,
71            ..default()
72        },
73    ));
74
75    // Cubes
76    let mesh_handle = mesh_assets.add(Cuboid::from_size(Vec3::ONE));
77    for x in 0..n {
78        for z in 0..n {
79            commands.spawn((
80                Mesh3d(mesh_handle.clone()),
81                MeshMaterial3d(material_assets.add(Color::WHITE)),
82                Transform::from_translation(Vec3::new(x as f32, 0.0, z as f32)),
83            ));
84        }
85    }
86}
examples/shader/storage_buffer.rs (line 40)
23fn setup(
24    mut commands: Commands,
25    mut meshes: ResMut<Assets<Mesh>>,
26    mut buffers: ResMut<Assets<ShaderStorageBuffer>>,
27    mut materials: ResMut<Assets<CustomMaterial>>,
28) {
29    // Example data for the storage buffer
30    let color_data: Vec<[f32; 4]> = vec![
31        [1.0, 0.0, 0.0, 1.0],
32        [0.0, 1.0, 0.0, 1.0],
33        [0.0, 0.0, 1.0, 1.0],
34        [1.0, 1.0, 0.0, 1.0],
35        [0.0, 1.0, 1.0, 1.0],
36    ];
37
38    let colors = buffers.add(ShaderStorageBuffer::from(color_data));
39
40    let mesh_handle = meshes.add(Cuboid::from_size(Vec3::splat(0.3)));
41    // Create the custom material with the storage buffer
42    let material_handle = materials.add(CustomMaterial {
43        colors: colors.clone(),
44    });
45
46    commands.insert_resource(CustomMaterialHandle(material_handle.clone()));
47
48    // Spawn cubes with the custom material
49    let mut current_color_id: u32 = 0;
50    for i in -6..=6 {
51        for j in -3..=3 {
52            commands.spawn((
53                Mesh3d(mesh_handle.clone()),
54                MeshMaterial3d(material_handle.clone()),
55                MeshTag(current_color_id % 5),
56                Transform::from_xyz(i as f32, j as f32, 0.0),
57            ));
58            current_color_id += 1;
59        }
60    }
61
62    // Camera
63    commands.spawn((
64        Camera3d::default(),
65        Transform::from_xyz(0.0, 0.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
66    ));
67}
examples/shader/automatic_instancing.rs (line 40)
30fn setup(
31    mut commands: Commands,
32    assets: Res<AssetServer>,
33    mut meshes: ResMut<Assets<Mesh>>,
34    mut materials: ResMut<Assets<CustomMaterial>>,
35) {
36    // We will use this image as our external data for our material to sample from in the vertex shader
37    let image = assets.load("branding/icon.png");
38
39    // Our single mesh handle that will be instanced
40    let mesh_handle = meshes.add(Cuboid::from_size(Vec3::splat(0.01)));
41
42    // Create the custom material with a reference to our texture
43    // Automatic instancing works with any Material, including the `StandardMaterial`.
44    // This custom material is used to demonstrate the optional `MeshTag` feature.
45    let material_handle = materials.add(CustomMaterial {
46        image: image.clone(),
47    });
48
49    // We're hardcoding the image dimensions for simplicity
50    let image_dims = UVec2::new(256, 256);
51    let total_pixels = image_dims.x * image_dims.y;
52
53    for index in 0..total_pixels {
54        // Get x,y from index - x goes left to right, y goes top to bottom
55        let x = index % image_dims.x;
56        let y = index / image_dims.x;
57
58        // Convert to centered world coordinates
59        let world_x = (x as f32 - image_dims.x as f32 / 2.0) / 50.0;
60        let world_y = -((y as f32 - image_dims.y as f32 / 2.0) / 50.0); // Still need negative for world space
61
62        commands.spawn((
63            // For automatic instancing to take effect you need to
64            // use the same mesh handle and material handle for each instance
65            Mesh3d(mesh_handle.clone()),
66            MeshMaterial3d(material_handle.clone()),
67            // This is an optional component that can be used to help tie external data to a mesh instance
68            MeshTag(index),
69            Transform::from_xyz(world_x, world_y, 0.0),
70        ));
71    }
72
73    // Camera
74    commands.spawn((
75        Camera3d::default(),
76        Transform::from_xyz(0.0, 0.0, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
77    ));
78}
examples/3d/order_independent_transparency.rs (line 181)
175fn spawn_occlusion_test(
176    commands: &mut Commands,
177    meshes: &mut Assets<Mesh>,
178    materials: &mut Assets<StandardMaterial>,
179) {
180    let sphere_handle = meshes.add(Sphere::new(1.0).mesh());
181    let cube_handle = meshes.add(Cuboid::from_size(Vec3::ONE).mesh());
182    let cube_material = materials.add(Color::srgb(0.8, 0.7, 0.6));
183
184    let render_layers = RenderLayers::layer(1);
185
186    // front
187    let x = -2.5;
188    commands.spawn((
189        Mesh3d(cube_handle.clone()),
190        MeshMaterial3d(cube_material.clone()),
191        Transform::from_xyz(x, 0.0, 2.0),
192        render_layers.clone(),
193    ));
194    commands.spawn((
195        Mesh3d(sphere_handle.clone()),
196        MeshMaterial3d(materials.add(StandardMaterial {
197            base_color: RED.with_alpha(0.5).into(),
198            alpha_mode: AlphaMode::Blend,
199            ..default()
200        })),
201        Transform::from_xyz(x, 0., 0.),
202        render_layers.clone(),
203    ));
204
205    // intersection
206    commands.spawn((
207        Mesh3d(cube_handle.clone()),
208        MeshMaterial3d(cube_material.clone()),
209        Transform::from_xyz(x, 0.0, 1.0),
210        render_layers.clone(),
211    ));
212    commands.spawn((
213        Mesh3d(sphere_handle.clone()),
214        MeshMaterial3d(materials.add(StandardMaterial {
215            base_color: RED.with_alpha(0.5).into(),
216            alpha_mode: AlphaMode::Blend,
217            ..default()
218        })),
219        Transform::from_xyz(0., 0., 0.),
220        render_layers.clone(),
221    ));
222
223    // back
224    let x = 2.5;
225    commands.spawn((
226        Mesh3d(cube_handle.clone()),
227        MeshMaterial3d(cube_material.clone()),
228        Transform::from_xyz(x, 0.0, -2.0),
229        render_layers.clone(),
230    ));
231    commands.spawn((
232        Mesh3d(sphere_handle.clone()),
233        MeshMaterial3d(materials.add(StandardMaterial {
234            base_color: RED.with_alpha(0.5).into(),
235            alpha_mode: AlphaMode::Blend,
236            ..default()
237        })),
238        Transform::from_xyz(x, 0., 0.),
239        render_layers.clone(),
240    ));
241}
Source

pub fn from_corners(point1: Vec3, point2: Vec3) -> Cuboid

Create a new Cuboid from two corner points

Source

pub fn from_length(length: f32) -> Cuboid

Create a Cuboid from a single length. The resulting Cuboid will be the same size in every direction.

Examples found in repository?
examples/animation/eased_motion.rs (line 41)
19fn setup(
20    mut commands: Commands,
21    mut meshes: ResMut<Assets<Mesh>>,
22    mut materials: ResMut<Assets<StandardMaterial>>,
23    mut animation_graphs: ResMut<Assets<AnimationGraph>>,
24    mut animation_clips: ResMut<Assets<AnimationClip>>,
25) {
26    // Create the animation:
27    let AnimationInfo {
28        target_name: animation_target_name,
29        target_id: animation_target_id,
30        graph: animation_graph,
31        node_index: animation_node_index,
32    } = AnimationInfo::create(&mut animation_graphs, &mut animation_clips);
33
34    // Build an animation player that automatically plays the animation.
35    let mut animation_player = AnimationPlayer::default();
36    animation_player.play(animation_node_index).repeat();
37
38    // A cube together with the components needed to animate it
39    let cube_entity = commands
40        .spawn((
41            Mesh3d(meshes.add(Cuboid::from_length(2.0))),
42            MeshMaterial3d(materials.add(Color::from(ORANGE))),
43            Transform::from_translation(vec3(-6., 2., 0.)),
44            animation_target_name,
45            animation_player,
46            AnimationGraphHandle(animation_graph),
47        ))
48        .id();
49
50    commands.entity(cube_entity).insert(AnimationTarget {
51        id: animation_target_id,
52        player: cube_entity,
53    });
54
55    // Some light to see something
56    commands.spawn((
57        PointLight {
58            shadows_enabled: true,
59            intensity: 10_000_000.,
60            range: 100.0,
61            ..default()
62        },
63        Transform::from_xyz(8., 16., 8.),
64    ));
65
66    // Ground plane
67    commands.spawn((
68        Mesh3d(meshes.add(Plane3d::default().mesh().size(50., 50.))),
69        MeshMaterial3d(materials.add(Color::from(SILVER))),
70    ));
71
72    // The camera
73    commands.spawn((
74        Camera3d::default(),
75        Transform::from_xyz(0., 6., 12.).looking_at(Vec3::new(0., 1.5, 0.), Vec3::Y),
76    ));
77}
More examples
Hide additional examples
examples/3d/decal.rs (line 81)
22fn setup(
23    mut commands: Commands,
24    mut meshes: ResMut<Assets<Mesh>>,
25    mut standard_materials: ResMut<Assets<StandardMaterial>>,
26    mut decal_standard_materials: ResMut<Assets<ForwardDecalMaterial<StandardMaterial>>>,
27    asset_server: Res<AssetServer>,
28) {
29    // Spawn the forward decal
30    commands.spawn((
31        Name::new("Decal"),
32        ForwardDecal,
33        MeshMaterial3d(decal_standard_materials.add(ForwardDecalMaterial {
34            base: StandardMaterial {
35                base_color_texture: Some(asset_server.load("textures/uv_checker_bw.png")),
36                ..default()
37            },
38            extension: ForwardDecalMaterialExt {
39                depth_fade_factor: 1.0,
40            },
41        })),
42        Transform::from_scale(Vec3::splat(4.0)),
43    ));
44
45    commands.spawn((
46        Name::new("Camera"),
47        Camera3d::default(),
48        CameraController::default(),
49        DepthPrepass, // Must enable the depth prepass to render forward decals
50        Transform::from_xyz(2.0, 9.5, 2.5).looking_at(Vec3::ZERO, Vec3::Y),
51    ));
52
53    let white_material = standard_materials.add(Color::WHITE);
54
55    commands.spawn((
56        Name::new("Floor"),
57        Mesh3d(meshes.add(Rectangle::from_length(10.0))),
58        MeshMaterial3d(white_material.clone()),
59        Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
60    ));
61
62    // Spawn a few cube with random rotations to showcase how the decals behave with non-flat geometry
63    let num_obs = 10;
64    let mut rng = ChaCha8Rng::seed_from_u64(19878367467713);
65    for i in 0..num_obs {
66        for j in 0..num_obs {
67            let rotation_axis: [f32; 3] = rng.r#gen();
68            let rotation_vec: Vec3 = rotation_axis.into();
69            let rotation: u32 = rng.gen_range(0..360);
70            let transform = Transform::from_xyz(
71                (-num_obs + 1) as f32 / 2.0 + i as f32,
72                -0.2,
73                (-num_obs + 1) as f32 / 2.0 + j as f32,
74            )
75            .with_rotation(Quat::from_axis_angle(
76                rotation_vec.normalize_or_zero(),
77                (rotation as f32).to_radians(),
78            ));
79
80            commands.spawn((
81                Mesh3d(meshes.add(Cuboid::from_length(0.6))),
82                MeshMaterial3d(white_material.clone()),
83                transform,
84            ));
85        }
86    }
87
88    commands.spawn((
89        Name::new("Light"),
90        PointLight {
91            shadows_enabled: true,
92            ..default()
93        },
94        Transform::from_xyz(4.0, 8.0, 4.0),
95    ));
96}
examples/math/random_sampling.rs (line 68)
51fn setup(
52    mut commands: Commands,
53    mut meshes: ResMut<Assets<Mesh>>,
54    mut materials: ResMut<Assets<StandardMaterial>>,
55) {
56    // Use seeded rng and store it in a resource; this makes the random output reproducible.
57    let seeded_rng = ChaCha8Rng::seed_from_u64(19878367467712);
58    commands.insert_resource(RandomSource(seeded_rng));
59
60    // Make a plane for establishing space.
61    commands.spawn((
62        Mesh3d(meshes.add(Plane3d::default().mesh().size(12.0, 12.0))),
63        MeshMaterial3d(materials.add(Color::srgb(0.3, 0.5, 0.3))),
64        Transform::from_xyz(0.0, -2.5, 0.0),
65    ));
66
67    // Store the shape we sample from in a resource:
68    let shape = Cuboid::from_length(2.9);
69    commands.insert_resource(SampledShape(shape));
70
71    // The sampled shape shown transparently:
72    commands.spawn((
73        Mesh3d(meshes.add(shape)),
74        MeshMaterial3d(materials.add(StandardMaterial {
75            base_color: Color::srgba(0.2, 0.1, 0.6, 0.3),
76            alpha_mode: AlphaMode::Blend,
77            cull_mode: None,
78            ..default()
79        })),
80    ));
81
82    // A light:
83    commands.spawn((
84        PointLight {
85            shadows_enabled: true,
86            ..default()
87        },
88        Transform::from_xyz(4.0, 8.0, 4.0),
89    ));
90
91    // A camera:
92    commands.spawn((
93        Camera3d::default(),
94        Transform::from_xyz(-2.0, 3.0, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
95    ));
96
97    // Store the mesh and material for sample points in resources:
98    commands.insert_resource(PointMesh(
99        meshes.add(
100            Sphere::new(0.03)
101                .mesh()
102                .kind(SphereKind::Ico { subdivisions: 3 }),
103        ),
104    ));
105    commands.insert_resource(PointMaterial(materials.add(StandardMaterial {
106        base_color: Color::srgb(1.0, 0.8, 0.8),
107        metallic: 0.8,
108        ..default()
109    })));
110
111    // Instructions for the example:
112    commands.spawn((
113        Text::new(
114            "Controls:\n\
115            M: Toggle between sampling boundary and interior.\n\
116            R: Restart (erase all samples).\n\
117            S: Add one random sample.\n\
118            D: Add 100 random samples.\n\
119            Rotate camera by holding left mouse and panning left/right.",
120        ),
121        Node {
122            position_type: PositionType::Absolute,
123            top: Val::Px(12.0),
124            left: Val::Px(12.0),
125            ..default()
126        },
127    ));
128
129    // The mode starts with interior points.
130    commands.insert_resource(Mode::Interior);
131
132    // Starting mouse-pressed state is false.
133    commands.insert_resource(MousePressed(false));
134}
Source

pub fn size(&self) -> Vec3

Get the size of the cuboid

Source

pub fn closest_point(&self, point: Vec3) -> Vec3

Finds the point on the cuboid that is closest to the given point.

If the point is outside the cuboid, the returned point will be on the surface of the cuboid. Otherwise, it will be inside the cuboid and returned as is.

Trait Implementations§

Source§

impl Bounded3d for Cuboid

Source§

fn aabb_3d(&self, isometry: impl Into<Isometry3d>) -> Aabb3d

Get an axis-aligned bounding box for the shape translated and rotated by the given isometry.
Source§

fn bounding_sphere(&self, isometry: impl Into<Isometry3d>) -> BoundingSphere

Get a bounding sphere for the shape translated and rotated by the given isometry.
Source§

impl Clone for Cuboid

Source§

fn clone(&self) -> Cuboid

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cuboid

Source§

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

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

impl Default for Cuboid

Source§

fn default() -> Cuboid

Returns the default Cuboid with a width, height, and depth of 1.0.

Source§

impl<'de> Deserialize<'de> for Cuboid

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Cuboid, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Cuboid> for Mesh

Source§

fn from(cuboid: Cuboid) -> Mesh

Converts to this type from the input type.
Source§

impl FromArg for &'static Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

type This<'from_arg> = &'from_arg Cuboid

The type to convert into. Read more
Source§

fn from_arg( arg: Arg<'_>, ) -> Result<<&'static Cuboid as FromArg>::This<'_>, ArgError>

Creates an item from an argument. Read more
Source§

impl FromArg for &'static mut Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

type This<'from_arg> = &'from_arg mut Cuboid

The type to convert into. Read more
Source§

fn from_arg( arg: Arg<'_>, ) -> Result<<&'static mut Cuboid as FromArg>::This<'_>, ArgError>

Creates an item from an argument. Read more
Source§

impl FromArg for Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

type This<'from_arg> = Cuboid

The type to convert into. Read more
Source§

fn from_arg(arg: Arg<'_>) -> Result<<Cuboid as FromArg>::This<'_>, ArgError>

Creates an item from an argument. Read more
Source§

impl FromReflect for Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Cuboid>

Constructs a concrete instance of Self from a reflected value.
Source§

fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>

Attempts to downcast the given value to Self using, constructing the value using from_reflect if that fails. Read more
Source§

impl GetOwnership for &Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn ownership() -> Ownership

Returns the ownership of Self.
Source§

impl GetOwnership for &mut Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn ownership() -> Ownership

Returns the ownership of Self.
Source§

impl GetOwnership for Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn ownership() -> Ownership

Returns the ownership of Self.
Source§

impl GetTypeRegistration for Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn get_type_registration() -> TypeRegistration

Returns the default TypeRegistration for this type.
Source§

fn register_type_dependencies(registry: &mut TypeRegistry)

Registers other types needed by this type. Read more
Source§

impl<Config, Clear> GizmoPrimitive3d<Cuboid> for GizmoBuffer<Config, Clear>
where Config: GizmoConfigGroup, Clear: 'static + Send + Sync,

Source§

type Output<'a> = () where GizmoBuffer<Config, Clear>: 'a

The output of primitive_3d. This is a builder to set non-default values.
Source§

fn primitive_3d( &mut self, primitive: &Cuboid, isometry: impl Into<Isometry3d>, color: impl Into<Color>, ) -> <GizmoBuffer<Config, Clear> as GizmoPrimitive3d<Cuboid>>::Output<'_>

Renders a 3D primitive with its associated details.
Source§

impl IntoReturn for &Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn into_return<'into_return>(self) -> Return<'into_return>
where &Cuboid: 'into_return,

Converts Self into a Return value.
Source§

impl IntoReturn for &mut Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn into_return<'into_return>(self) -> Return<'into_return>
where &mut Cuboid: 'into_return,

Converts Self into a Return value.
Source§

impl IntoReturn for Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn into_return<'into_return>(self) -> Return<'into_return>
where Cuboid: 'into_return,

Converts Self into a Return value.
Source§

impl Measured3d for Cuboid

Source§

fn area(&self) -> f32

Get the surface area of the cuboid

Source§

fn volume(&self) -> f32

Get the volume of the cuboid

Source§

impl Meshable for Cuboid

Source§

type Output = CuboidMeshBuilder

The output of Self::mesh. This will be a MeshBuilder used for creating a Mesh.
Source§

fn mesh(&self) -> <Cuboid as Meshable>::Output

Creates a Mesh for a shape.
Source§

impl PartialEq for Cuboid

Source§

fn eq(&self, other: &Cuboid) -> bool

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

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

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

impl PartialReflect for Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn get_represented_type_info(&self) -> Option<&'static TypeInfo>

Returns the TypeInfo of the type represented by this value. Read more
Source§

fn try_apply( &mut self, value: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>

Tries to apply a reflected value to this value. Read more
Source§

fn reflect_kind(&self) -> ReflectKind

Returns a zero-sized enumeration of “kinds” of type. Read more
Source§

fn reflect_ref(&self) -> ReflectRef<'_>

Returns an immutable enumeration of “kinds” of type. Read more
Source§

fn reflect_mut(&mut self) -> ReflectMut<'_>

Returns a mutable enumeration of “kinds” of type. Read more
Source§

fn reflect_owned(self: Box<Cuboid>) -> ReflectOwned

Returns an owned enumeration of “kinds” of type. Read more
Source§

fn try_into_reflect( self: Box<Cuboid>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>

Attempts to cast this type to a boxed, fully-reflected value.
Source§

fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>

Attempts to cast this type to a fully-reflected value.
Source§

fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>

Attempts to cast this type to a mutable, fully-reflected value.
Source§

fn into_partial_reflect(self: Box<Cuboid>) -> Box<dyn PartialReflect>

Casts this type to a boxed, reflected value. Read more
Source§

fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)

Casts this type to a reflected value. Read more
Source§

fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)

Casts this type to a mutable, reflected value. Read more
Source§

fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>

Returns a “partial equality” comparison result. Read more
Source§

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

Debug formatter for the value. Read more
Source§

fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>

Attempts to clone Self using reflection. Read more
Source§

fn apply(&mut self, value: &(dyn PartialReflect + 'static))

Applies a reflected value to this value. Read more
Source§

fn clone_value(&self) -> Box<dyn PartialReflect>

👎Deprecated since 0.16.0: to clone reflected values, prefer using reflect_clone. To convert reflected values to dynamic ones, use to_dynamic.
Clones Self into its dynamic representation. Read more
Source§

fn to_dynamic(&self) -> Box<dyn PartialReflect>

Converts this reflected value into its dynamic representation based on its kind. Read more
Source§

fn reflect_hash(&self) -> Option<u64>

Returns a hash of the value (which includes the type). Read more
Source§

fn is_dynamic(&self) -> bool

Indicates whether or not this type is a dynamic type. Read more
Source§

impl Reflect for Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn into_any(self: Box<Cuboid>) -> Box<dyn Any>

Returns the value as a Box<dyn Any>. Read more
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Returns the value as a &dyn Any. Read more
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Returns the value as a &mut dyn Any. Read more
Source§

fn into_reflect(self: Box<Cuboid>) -> Box<dyn Reflect>

Casts this type to a boxed, fully-reflected value.
Source§

fn as_reflect(&self) -> &(dyn Reflect + 'static)

Casts this type to a fully-reflected value.
Source§

fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)

Casts this type to a mutable, fully-reflected value.
Source§

fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>

Performs a type-checked assignment of a reflected value to this value. Read more
Source§

impl Serialize for Cuboid

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ShapeSample for Cuboid

Source§

type Output = Vec3

The type of vector returned by the sample methods, Vec2 for 2D shapes and Vec3 for 3D shapes.
Source§

fn sample_interior<R>(&self, rng: &mut R) -> Vec3
where R: Rng + ?Sized,

Uniformly sample a point from inside the area/volume of this shape, centered on 0. Read more
Source§

fn sample_boundary<R>(&self, rng: &mut R) -> Vec3
where R: Rng + ?Sized,

Uniformly sample a point from the surface of this shape, centered on 0. Read more
Source§

fn interior_dist(self) -> impl Distribution<Self::Output>
where Self: Sized,

Extract a Distribution whose samples are points of this shape’s interior, taken uniformly. Read more
Source§

fn boundary_dist(self) -> impl Distribution<Self::Output>
where Self: Sized,

Extract a Distribution whose samples are points of this shape’s boundary, taken uniformly. Read more
Source§

impl Struct for Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>

Returns a reference to the value of the field named name as a &dyn PartialReflect.
Source§

fn field_mut( &mut self, name: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>

Returns a mutable reference to the value of the field named name as a &mut dyn PartialReflect.
Source§

fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>

Returns a reference to the value of the field with index index as a &dyn PartialReflect.
Source§

fn field_at_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>

Returns a mutable reference to the value of the field with index index as a &mut dyn PartialReflect.
Source§

fn name_at(&self, index: usize) -> Option<&str>

Returns the name of the field with index index.
Source§

fn field_len(&self) -> usize

Returns the number of fields in the struct.
Source§

fn iter_fields(&self) -> FieldIter<'_>

Returns an iterator over the values of the reflectable fields for this struct.
Source§

fn to_dynamic_struct(&self) -> DynamicStruct

Source§

fn clone_dynamic(&self) -> DynamicStruct

👎Deprecated since 0.16.0: use to_dynamic_struct instead
Clones the struct into a DynamicStruct.
Source§

fn get_represented_struct_info(&self) -> Option<&'static StructInfo>

Will return None if TypeInfo is not available.
Source§

impl TypePath for Cuboid
where Cuboid: Any + Send + Sync,

Source§

fn type_path() -> &'static str

Returns the fully qualified path of the underlying type. Read more
Source§

fn short_type_path() -> &'static str

Returns a short, pretty-print enabled path to the type. Read more
Source§

fn type_ident() -> Option<&'static str>

Returns the name of the type, or None if it is anonymous. Read more
Source§

fn crate_name() -> Option<&'static str>

Returns the name of the crate the type is in, or None if it is anonymous. Read more
Source§

fn module_path() -> Option<&'static str>

Returns the path to the module the type is in, or None if it is anonymous. Read more
Source§

impl Typed for Cuboid
where Cuboid: Any + Send + Sync, Vec3: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn type_info() -> &'static TypeInfo

Returns the compile-time info for the underlying type.
Source§

impl Copy for Cuboid

Source§

impl Primitive3d for Cuboid

Source§

impl StructuralPartialEq for Cuboid

Auto Trait Implementations§

§

impl Freeze for Cuboid

§

impl RefUnwindSafe for Cuboid

§

impl Send for Cuboid

§

impl Sync for Cuboid

§

impl Unpin for Cuboid

§

impl UnwindSafe for Cuboid

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Conv for T

Source§

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

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

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

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

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

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

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

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

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

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

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

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

Source§

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

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

impl<T> DynamicTypePath for T
where T: TypePath,

Source§

impl<T> DynamicTyped for T
where T: Typed,

Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

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

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

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

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

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

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

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

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

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

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

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

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

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

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

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

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

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> FromWorld for T
where T: Default,

Source§

fn from_world(_world: &mut World) -> T

Creates Self using default().

Source§

impl<S> GetField for S
where S: Struct,

Source§

fn get_field<T>(&self, name: &str) -> Option<&T>
where T: Reflect,

Returns a reference to the value of the field named name, downcast to T.
Source§

fn get_field_mut<T>(&mut self, name: &str) -> Option<&mut T>
where T: Reflect,

Returns a mutable reference to the value of the field named name, downcast to T.
Source§

impl<T> GetPath for T
where T: Reflect + ?Sized,

Source§

fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>

Returns a reference to the value specified by path. Read more
Source§

fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>

Returns a mutable reference to the value specified by path. Read more
Source§

fn path<'p, T>( &self, path: impl ReflectPath<'p>, ) -> Result<&T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed reference to the value specified by path. Read more
Source§

fn path_mut<'p, T>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed mutable reference to the value specified by path. Read more
Source§

impl<T> Instrument for T

Source§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn into_sample(self) -> T

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

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

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> Tap for T

Source§

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

Immutable access to a value. Read more
Source§

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

Mutable access to a value. Read more
Source§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

fn to_sample_(self) -> U

Source§

impl<T> TryConv for T

Source§

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

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

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

impl<T> Reflectable for T

Source§

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

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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