Skip to main content

MeshData

Struct MeshData 

Source
pub struct MeshData<P: Part = NoParts, C: Clip = NoClips> { /* private fields */ }
Expand description

A mesh’s vertices and indices, in the slots the parts P select, posed by the clips C name.

The indices define counter-clockwise triangles; the draw’s transform places and scales the mesh.

Implementations§

Source§

impl MeshData

Source

pub fn new(vertices: Vec<Vertex>, indices: Vec<u32>) -> Self

A mesh of one slot, drawn with Material::default.

Every index must point to a vertex; one past them is an error the catalog run reports. Every triangle’s three indices run counter-clockwise seen from outside the mesh: a triangle seen from behind is not drawn.

Examples found in repository?
examples/sound-lab.rs (line 185)
164fn ring_outline() -> MeshData {
165    const SEGMENTS: u32 = 48;
166    const OUTER: f32 = 1.0;
167    const INNER: f32 = 0.94;
168
169    let mut vertices = Vec::with_capacity(SEGMENTS as usize * 4);
170    let mut indices = Vec::with_capacity(SEGMENTS as usize * 6);
171    for segment in 0..SEGMENTS {
172        let a0 = segment as f32 / SEGMENTS as f32 * TAU;
173        let a1 = (segment + 1) as f32 / SEGMENTS as f32 * TAU;
174        let (u0, v0) = (a0.cos(), a0.sin());
175        let (u1, v1) = (a1.cos(), a1.sin());
176        let base = vertices.len() as u32;
177        vertices.extend([
178            Vertex::new(Vec3::new(INNER * u0, 0.0, -INNER * v0), Vec3::Y, Vec2::ZERO),
179            Vertex::new(Vec3::new(OUTER * u0, 0.0, -OUTER * v0), Vec3::Y, Vec2::ZERO),
180            Vertex::new(Vec3::new(OUTER * u1, 0.0, -OUTER * v1), Vec3::Y, Vec2::ZERO),
181            Vertex::new(Vec3::new(INNER * u1, 0.0, -INNER * v1), Vec3::Y, Vec2::ZERO),
182        ]);
183        indices.extend([base, base + 1, base + 2, base, base + 2, base + 3]);
184    }
185    MeshData::new(vertices, indices)
186}
187
188fn facing_marker() -> MeshData {
189    const TIP: Vec3 = Vec3::new(0.0, 0.0, -0.5);
190    const BACK: [Vec3; 4] = [
191        Vec3::new(-0.5, -0.5, 0.5),
192        Vec3::new(0.5, -0.5, 0.5),
193        Vec3::new(0.5, 0.5, 0.5),
194        Vec3::new(-0.5, 0.5, 0.5),
195    ];
196
197    let mut vertices = Vec::with_capacity(BACK.len() * 3);
198    for (corner, next) in BACK.iter().zip(BACK.iter().cycle().skip(1)) {
199        let normal = (next - corner).cross(TIP - corner).normalize();
200        vertices.extend([
201            Vertex::new(*corner, normal, Vec2::new(0.0, 1.0)),
202            Vertex::new(*next, normal, Vec2::new(1.0, 1.0)),
203            Vertex::new(TIP, normal, Vec2::new(0.5, 0.0)),
204        ]);
205    }
206    let indices = (0..vertices.len() as u32).collect();
207    MeshData::new(vertices, indices)
208}
More examples
Hide additional examples
examples/stress-preview.rs (line 551)
525fn build_rock(seed: u32) -> MeshData {
526    let height = ROCK_HEIGHT * (1.0 + hash_signed(seed, ROCK_SIDES) * ROCK_HEIGHT_DISPLACEMENT);
527    let apex = Vec3::Y * height;
528    let base: Vec<Vec3> = (0..ROCK_SIDES)
529        .map(|corner| {
530            let angle = core::f32::consts::TAU * corner as f32 / ROCK_SIDES as f32;
531            let radius =
532                ROCK_BASE_RADIUS * (1.0 + hash_signed(seed, corner) * ROCK_RADIAL_DISPLACEMENT);
533            Vec3::new(angle.cos() * radius, 0.0, angle.sin() * radius)
534        })
535        .collect();
536
537    let mut vertices = Vec::with_capacity(base.len() * 6);
538    let mut indices = Vec::with_capacity(base.len() * 6);
539    for corner in 0..base.len() {
540        let next = (corner + 1) % base.len();
541        push_face(&mut vertices, &mut indices, base[corner], apex, base[next]);
542        push_face(
543            &mut vertices,
544            &mut indices,
545            base[corner],
546            base[next],
547            Vec3::ZERO,
548        );
549    }
550
551    MeshData::new(vertices, indices).with_material(Material::lit(ROCK_COLOR))
552}
examples/material-playground.rs (line 403)
360fn banner_mesh() -> MeshData {
361    let mut vertices = Vec::with_capacity(((BANNER_COLUMNS + 1) * 4) as usize);
362    for normal in [Vec3::Z, Vec3::NEG_Z] {
363        for column in 0..=BANNER_COLUMNS {
364            let u = column as f32 / BANNER_COLUMNS as f32;
365            let x = u * BANNER_WIDTH;
366            for v in [0.0, 1.0] {
367                vertices.push(Vertex::new(
368                    Vec3::new(x, -v * BANNER_HEIGHT, 0.0),
369                    normal,
370                    Vec2::new(u, v),
371                ));
372            }
373        }
374    }
375
376    let side = BANNER_COLUMNS + 1;
377    let mut indices = Vec::with_capacity((BANNER_COLUMNS * 12) as usize);
378    for column in 0..BANNER_COLUMNS {
379        let top_left = column * 2;
380        let bottom_left = top_left + 1;
381        let top_right = top_left + 2;
382        let bottom_right = top_left + 3;
383        indices.extend([
384            bottom_left,
385            bottom_right,
386            top_right,
387            bottom_left,
388            top_right,
389            top_left,
390        ]);
391
392        let back = side * 2;
393        indices.extend([
394            back + top_right,
395            back + bottom_right,
396            back + bottom_left,
397            back + top_left,
398            back + top_right,
399            back + bottom_left,
400        ]);
401    }
402
403    MeshData::new(vertices, indices)
404}
examples/isometric-board.rs (line 759)
724fn build_rock(seed: u32) -> MeshData {
725    let corners: [Vec3; 8] = core::array::from_fn(|index| {
726        let sign = Vec3::new(
727            if index & 1 == 0 { -0.5 } else { 0.5 },
728            if index & 2 == 0 { -0.5 } else { 0.5 },
729            if index & 4 == 0 { -0.5 } else { 0.5 },
730        );
731        sign + corner_offset(seed, index as u32)
732    });
733    let corner_at = |sign: Vec3| corners[corner_index(sign)];
734
735    let mut vertices = Vec::with_capacity(ROCK_FACES.len() * 4);
736    let mut indices = Vec::with_capacity(ROCK_FACES.len() * 6);
737    for (face, &(normal, right, up)) in ROCK_FACES.iter().enumerate() {
738        let quad = [
739            corner_at(normal - right - up),
740            corner_at(normal + right - up),
741            corner_at(normal + right + up),
742            corner_at(normal - right + up),
743        ];
744        let normal = (quad[1] - quad[0]).cross(quad[3] - quad[0]).normalize();
745        let uvs = [
746            Vec2::new(0.0, 1.0),
747            Vec2::new(1.0, 1.0),
748            Vec2::new(1.0, 0.0),
749            Vec2::new(0.0, 0.0),
750        ];
751        vertices.extend(
752            quad.into_iter()
753                .zip(uvs)
754                .map(|(corner, uv)| Vertex::new(corner, normal, uv)),
755        );
756        let base = face as u32 * 4;
757        indices.extend(ROCK_TRIANGLES.map(|index| base + index));
758    }
759    MeshData::new(vertices, indices)
760}
Source§

impl<P: Part, C: Clip> MeshData<P, C>

Source

pub fn with_material(self, material: Material) -> Self

Sets the material of every slot.

Examples found in repository?
examples/material-playground.rs (line 284)
279fn sphere_with_material(assets: &Assets, material: Material) -> MeshData {
280    Sphere {
281        subdivisions: SPHERE_SUBDIVISIONS,
282    }
283    .build(assets)
284    .with_material(material)
285}
286
287fn cube_with_material(assets: &Assets, material: Material) -> MeshData {
288    Cube.build(assets).with_material(material)
289}
More examples
Hide additional examples
examples/sprite-adventure.rs (line 586)
582    fn build(&self, assets: &Assets) -> MeshData {
583        Plane
584            .build(assets)
585            .with_texture(assets.texture(POND_SHEET).pixelated())
586            .with_material(Material::lit(Color::WHITE).cutout())
587    }
588}
589
590/// A crate prop, its texture drawn over a cube.
591#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
592struct Crate;
593
594impl Mesh for Crate {
595    fn build(&self, assets: &Assets) -> MeshData {
596        Cube.build(assets)
597            .with_texture(assets.texture(CRATE_TEXTURE).pixelated())
598    }
599}
600
601/// The well's rim.
602#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
603struct Well;
604
605impl Mesh for Well {
606    fn build(&self, assets: &Assets) -> MeshData {
607        Cube.build(assets)
608            .with_texture(assets.texture(WELL_SHEET).pixelated())
609    }
610}
611
612/// The well's mouth, laid flat over the rim's top face.
613#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
614struct WellMouth;
615
616impl Mesh for WellMouth {
617    fn build(&self, assets: &Assets) -> MeshData {
618        Plane
619            .build(assets)
620            .with_texture(assets.texture(WELL_SHEET).pixelated())
621    }
622}
623
624/// A stone box: the mouth's pillars and lintel.
625#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
626struct Stone;
627
628impl Mesh for Stone {
629    fn build(&self, assets: &Assets) -> MeshData {
630        Cube.build(assets)
631            .with_texture(assets.texture(STONE_SHEET).pixelated())
632    }
633}
634
635/// A bush sprite, cutout with its own relief.
636#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
637struct Bush;
638
639impl Mesh for Bush {
640    fn build(&self, assets: &Assets) -> MeshData {
641        Quad.build(assets)
642            .with_texture(assets.texture(BUSH_SPRITE).pixelated())
643            .with_relief(assets.relief(BUSH_RELIEF))
644            .with_material(Material::lit(Color::WHITE).cutout())
645    }
646}
647
648/// A rock sprite, cutout with its own relief.
649#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
650struct Rock;
651
652impl Mesh for Rock {
653    fn build(&self, assets: &Assets) -> MeshData {
654        Quad.build(assets)
655            .with_texture(assets.texture(ROCK_SPRITE).pixelated())
656            .with_relief(assets.relief(ROCK_RELIEF))
657            .with_material(Material::lit(Color::WHITE).cutout())
658    }
659}
660
661/// A torch's post sprite, cutout with its own relief.
662#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
663struct Torch;
664
665impl Mesh for Torch {
666    fn build(&self, assets: &Assets) -> MeshData {
667        Quad.build(assets)
668            .with_texture(assets.texture(TORCH_SPRITE).pixelated())
669            .with_relief(assets.relief(TORCH_RELIEF))
670            .with_material(Material::lit(Color::WHITE).cutout())
671    }
672}
673
674/// A torch's flame sprite, added over the dark rather than lit.
675#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
676struct Flame;
677
678impl Mesh for Flame {
679    fn build(&self, assets: &Assets) -> MeshData {
680        Quad.build(assets)
681            .with_texture(assets.texture(FLAME_SHEET).pixelated())
682            .with_material(Material::color(FLAME_TINT).additive())
683    }
684}
685
686/// The player's sprite, cutout with its own relief, its sheet shared
687/// with `examples/isometric-board.rs`.
688#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
689struct Walker;
690
691impl Mesh for Walker {
692    fn build(&self, assets: &Assets) -> MeshData {
693        Quad.build(assets)
694            .with_texture(assets.texture(WALKER_SHEET).pixelated())
695            .with_relief(assets.relief(WALKER_RELIEF))
696            .with_material(Material::lit(Color::WHITE).cutout())
697    }
examples/stress-preview.rs (line 551)
525fn build_rock(seed: u32) -> MeshData {
526    let height = ROCK_HEIGHT * (1.0 + hash_signed(seed, ROCK_SIDES) * ROCK_HEIGHT_DISPLACEMENT);
527    let apex = Vec3::Y * height;
528    let base: Vec<Vec3> = (0..ROCK_SIDES)
529        .map(|corner| {
530            let angle = core::f32::consts::TAU * corner as f32 / ROCK_SIDES as f32;
531            let radius =
532                ROCK_BASE_RADIUS * (1.0 + hash_signed(seed, corner) * ROCK_RADIAL_DISPLACEMENT);
533            Vec3::new(angle.cos() * radius, 0.0, angle.sin() * radius)
534        })
535        .collect();
536
537    let mut vertices = Vec::with_capacity(base.len() * 6);
538    let mut indices = Vec::with_capacity(base.len() * 6);
539    for corner in 0..base.len() {
540        let next = (corner + 1) % base.len();
541        push_face(&mut vertices, &mut indices, base[corner], apex, base[next]);
542        push_face(
543            &mut vertices,
544            &mut indices,
545            base[corner],
546            base[next],
547            Vec3::ZERO,
548        );
549    }
550
551    MeshData::new(vertices, indices).with_material(Material::lit(ROCK_COLOR))
552}
Source

pub fn with_texture(self, texture: TextureData) -> Self

Samples every slot from texture, in place of a white default.

Examples found in repository?
examples/isometric-board.rs (line 198)
196    fn build(&self, assets: &Assets) -> MeshData {
197        Quad.build(assets)
198            .with_texture(assets.texture(SPRITE_TEXTURE).pixelated())
199    }
More examples
Hide additional examples
examples/sprite-adventure.rs (line 572)
569    fn build(&self, assets: &Assets) -> MeshData {
570        Plane
571            .build(assets)
572            .with_texture(assets.texture(GROUND_SHEET).pixelated())
573    }
574}
575
576/// The shoreline sprite laid over the pond's styled water, cutout so the
577/// water shows through its cleared middle.
578#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
579struct Shore;
580
581impl Mesh for Shore {
582    fn build(&self, assets: &Assets) -> MeshData {
583        Plane
584            .build(assets)
585            .with_texture(assets.texture(POND_SHEET).pixelated())
586            .with_material(Material::lit(Color::WHITE).cutout())
587    }
588}
589
590/// A crate prop, its texture drawn over a cube.
591#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
592struct Crate;
593
594impl Mesh for Crate {
595    fn build(&self, assets: &Assets) -> MeshData {
596        Cube.build(assets)
597            .with_texture(assets.texture(CRATE_TEXTURE).pixelated())
598    }
599}
600
601/// The well's rim.
602#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
603struct Well;
604
605impl Mesh for Well {
606    fn build(&self, assets: &Assets) -> MeshData {
607        Cube.build(assets)
608            .with_texture(assets.texture(WELL_SHEET).pixelated())
609    }
610}
611
612/// The well's mouth, laid flat over the rim's top face.
613#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
614struct WellMouth;
615
616impl Mesh for WellMouth {
617    fn build(&self, assets: &Assets) -> MeshData {
618        Plane
619            .build(assets)
620            .with_texture(assets.texture(WELL_SHEET).pixelated())
621    }
622}
623
624/// A stone box: the mouth's pillars and lintel.
625#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
626struct Stone;
627
628impl Mesh for Stone {
629    fn build(&self, assets: &Assets) -> MeshData {
630        Cube.build(assets)
631            .with_texture(assets.texture(STONE_SHEET).pixelated())
632    }
633}
634
635/// A bush sprite, cutout with its own relief.
636#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
637struct Bush;
638
639impl Mesh for Bush {
640    fn build(&self, assets: &Assets) -> MeshData {
641        Quad.build(assets)
642            .with_texture(assets.texture(BUSH_SPRITE).pixelated())
643            .with_relief(assets.relief(BUSH_RELIEF))
644            .with_material(Material::lit(Color::WHITE).cutout())
645    }
646}
647
648/// A rock sprite, cutout with its own relief.
649#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
650struct Rock;
651
652impl Mesh for Rock {
653    fn build(&self, assets: &Assets) -> MeshData {
654        Quad.build(assets)
655            .with_texture(assets.texture(ROCK_SPRITE).pixelated())
656            .with_relief(assets.relief(ROCK_RELIEF))
657            .with_material(Material::lit(Color::WHITE).cutout())
658    }
659}
660
661/// A torch's post sprite, cutout with its own relief.
662#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
663struct Torch;
664
665impl Mesh for Torch {
666    fn build(&self, assets: &Assets) -> MeshData {
667        Quad.build(assets)
668            .with_texture(assets.texture(TORCH_SPRITE).pixelated())
669            .with_relief(assets.relief(TORCH_RELIEF))
670            .with_material(Material::lit(Color::WHITE).cutout())
671    }
672}
673
674/// A torch's flame sprite, added over the dark rather than lit.
675#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
676struct Flame;
677
678impl Mesh for Flame {
679    fn build(&self, assets: &Assets) -> MeshData {
680        Quad.build(assets)
681            .with_texture(assets.texture(FLAME_SHEET).pixelated())
682            .with_material(Material::color(FLAME_TINT).additive())
683    }
684}
685
686/// The player's sprite, cutout with its own relief, its sheet shared
687/// with `examples/isometric-board.rs`.
688#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
689struct Walker;
690
691impl Mesh for Walker {
692    fn build(&self, assets: &Assets) -> MeshData {
693        Quad.build(assets)
694            .with_texture(assets.texture(WALKER_SHEET).pixelated())
695            .with_relief(assets.relief(WALKER_RELIEF))
696            .with_material(Material::lit(Color::WHITE).cutout())
697    }
698}
699
700/// The cave floor tile.
701#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
702struct CaveFloor;
703
704impl Mesh for CaveFloor {
705    fn build(&self, assets: &Assets) -> MeshData {
706        Plane
707            .build(assets)
708            .with_texture(assets.texture(CAVE_SHEET).pixelated())
709    }
710}
711
712/// The cave wall face.
713#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
714struct CaveWall;
715
716impl Mesh for CaveWall {
717    fn build(&self, assets: &Assets) -> MeshData {
718        Cube.build(assets)
719            .with_texture(assets.texture(CAVE_SHEET).pixelated())
720    }
examples/flock-parallelism.rs (line 162)
159    fn build(&self, assets: &Assets) -> MeshData<NoParts, ButterflyClip> {
160        assets
161            .model(BUTTERFLY_ROOT)
162            .with_texture(greyed(&assets.texture(BUTTERFLY_SKIN)))
163    }
Source

pub fn with_relief(self, relief: ReliefData) -> Self

Reads the relief of every slot from relief.

See Slot::relief for what the channels hold and which draws read them.

Examples found in repository?
examples/material-playground.rs (line 206)
205    fn build(&self, assets: &Assets) -> MeshData {
206        sphere_with_material(assets, relief_material()).with_relief(relief_bumps())
207    }
More examples
Hide additional examples
examples/sprite-adventure.rs (line 643)
640    fn build(&self, assets: &Assets) -> MeshData {
641        Quad.build(assets)
642            .with_texture(assets.texture(BUSH_SPRITE).pixelated())
643            .with_relief(assets.relief(BUSH_RELIEF))
644            .with_material(Material::lit(Color::WHITE).cutout())
645    }
646}
647
648/// A rock sprite, cutout with its own relief.
649#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
650struct Rock;
651
652impl Mesh for Rock {
653    fn build(&self, assets: &Assets) -> MeshData {
654        Quad.build(assets)
655            .with_texture(assets.texture(ROCK_SPRITE).pixelated())
656            .with_relief(assets.relief(ROCK_RELIEF))
657            .with_material(Material::lit(Color::WHITE).cutout())
658    }
659}
660
661/// A torch's post sprite, cutout with its own relief.
662#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
663struct Torch;
664
665impl Mesh for Torch {
666    fn build(&self, assets: &Assets) -> MeshData {
667        Quad.build(assets)
668            .with_texture(assets.texture(TORCH_SPRITE).pixelated())
669            .with_relief(assets.relief(TORCH_RELIEF))
670            .with_material(Material::lit(Color::WHITE).cutout())
671    }
672}
673
674/// A torch's flame sprite, added over the dark rather than lit.
675#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
676struct Flame;
677
678impl Mesh for Flame {
679    fn build(&self, assets: &Assets) -> MeshData {
680        Quad.build(assets)
681            .with_texture(assets.texture(FLAME_SHEET).pixelated())
682            .with_material(Material::color(FLAME_TINT).additive())
683    }
684}
685
686/// The player's sprite, cutout with its own relief, its sheet shared
687/// with `examples/isometric-board.rs`.
688#[derive(Catalog, Clone, PartialEq, Eq, Hash)]
689struct Walker;
690
691impl Mesh for Walker {
692    fn build(&self, assets: &Assets) -> MeshData {
693        Quad.build(assets)
694            .with_texture(assets.texture(WALKER_SHEET).pixelated())
695            .with_relief(assets.relief(WALKER_RELIEF))
696            .with_material(Material::lit(Color::WHITE).cutout())
697    }
Source

pub fn with_shading(self, shading: ShadingData) -> Self

Reads the shading of every slot from shading.

See Slot::shading for what the channels hold and what each one scales.

Examples found in repository?
examples/material-playground.rs (line 185)
184    fn build(&self, assets: &Assets) -> MeshData {
185        sphere_with_material(assets, shading_material()).with_shading(shading_checker())
186    }
Source

pub fn with_emissive_map(self, emissive: TextureData) -> Self

Reads the light every slot casts per texel from emissive.

See Slot::emissive_map for what scales it.

Examples found in repository?
examples/material-playground.rs (line 227)
226    fn build(&self, assets: &Assets) -> MeshData {
227        cube_with_material(assets, emissive_material()).with_emissive_map(emissive_checker())
228    }
Source§

impl<P: Part> MeshData<P, NoClips>

Source

pub fn in_parts( vertices: Vec<Vertex>, indices: Vec<u32>, slot: impl FnMut(P) -> Slot, ) -> Self

A mesh of one slot per part, in the order the parts count themselves, each slot taking the next indices.

Required if you want a generated mesh with parts a draw repaints one at a time. slot runs once per part, so every part has a slot. The slot lengths must cover the indices exactly; otherwise that is an error the catalog run reports. Every triangle’s three indices run counter-clockwise seen from outside the mesh: a triangle seen from behind is not drawn.

Source§

impl<P: Part, C: Clip> MeshData<P, C>

Source

pub fn vertices(&self) -> &[Vertex]

The mesh’s vertices, in the order the vertex buffer takes them.

Source

pub fn indices(&self) -> &[u32]

The triangle indices, three per triangle, counter-clockwise.

Source

pub fn slots(&self) -> &[Slot]

The mesh’s slots, in index order.

Trait Implementations§

Source§

impl<P: Clone + Part, C: Clone + Clip> Clone for MeshData<P, C>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<P: Debug + Part, C: Debug + Clip> Debug for MeshData<P, C>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P, C> Freeze for MeshData<P, C>

§

impl<P, C> RefUnwindSafe for MeshData<P, C>

§

impl<P, C> Send for MeshData<P, C>

§

impl<P, C> Sync for MeshData<P, C>

§

impl<P, C> Unpin for MeshData<P, C>

§

impl<P, C> UnsafeUnpin for MeshData<P, C>

§

impl<P, C> UnwindSafe for MeshData<P, C>

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

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

Source§

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

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

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

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> Instrument for T

Source§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

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

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

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

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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> Upcast<T> for T

Source§

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

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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

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