Repository: bevyengine/bevy
File: crates/bevy_gltf/src/loader/extensions/mod.rs (Rust)

Code before:
    fn on_material(
        &mut self,
        load_context: &mut LoadContext<'_>,
        gltf_material: &gltf::Material,
        material: Handle<GltfMaterial>,
        material_asset: &GltfMaterial,
        material_label: &str,
    ) {
    }

    /// Called when an individual glTF primitive is processed
    /// glTF primitives are what become a Bevy `Mesh`
    #[expect(
        unused,
        reason = "default trait implementations do not use the arguments because they are no-ops"
    )]
    fn on_gltf_primitive(
        &mut self,
        load_context: &mut LoadContext<'_>,
        gltf_document: &gltf::Gltf,
        gltf_primitive: &gltf::Primitive,
        #[expect(
            clippy::ptr_arg,
            reason = "on_gltf_primitive requires &Vec<Vec<u8>> for external API compatibility"
        )]
        buffer_data: &Vec<Vec<u8>>,
        out_doc: &mut Option<gltf::Document>,
        out_data: &mut Option<Vec<Vec<u8>>>,
    ) {
    }

    /// Called when an individual glTF Mesh is processed
    #[expect(
        unused,
        reason = "default trait implementations do not use the arguments because they are no-ops"
    )]
    fn on_gltf_mesh(
        &mut self,
        load_context: &mut LoadContext<'_>,
        gltf_mesh: &gltf::Mesh,
        mesh: Handle<GltfMesh>,
    ) {
    }

    /// mesh and material are spawned as a single Entity,
    /// which means an extension would have to decide for
    /// itself how to merge the extension data.
    #[expect(
        unused,
        reason = "default trait implementations do not use the arguments because they are no-ops"
    )]

Review comment (suggestion):
Can you explain more why this needs to be a &Vec<Vec>? In `https://github.com/jiangheng90-opensource/bevy_gltf_draco/blob/main/src/khr_draco_mesh_compression.rs` you could just ask for a `&[Vec<u8>]` instead (I know this means changing the API which is unfortunate, but I don't think we should degrade our API for this).

Code after:
    fn on_material(
        &mut self,
        load_context: &mut LoadContext<'_>,
        gltf_material: &gltf::Material,
        material: Handle<GltfMaterial>,
        material_asset: &GltfMaterial,
        material_label: &str,
    ) {
    }

    /// Called when an individual glTF primitive is processed
    /// glTF primitives are what become a Bevy `Mesh`
    ///
    /// `buffer_data` is the raw buffer data from the glTF file, where each `Vec<u8>` represents
    /// a buffer containing geometry data such as vertex attributes and indices. Extensions can
    /// read this data to process compressed or encoded primitive data.
    ///
    /// `out_doc` allows extensions to provide a modified or
    /// replacement glTF document. If set, the loader will use this modified document for subsequent
    /// primitive processing. This is useful for extensions that need to decompress or transform
    /// the glTF structure before it is processed.
    ///
    /// `out_data` allows extensions to provide modified or
    /// replacement buffer data. If set, the loader will use this modified buffer data instead of
    /// the original `buffer_data`. This is useful for extensions like `EXT_meshopt_compression`
    /// that need to decompress buffer data before the primitive is processed.
    #[expect(
        unused,
        reason = "default trait implementations do not use the arguments because they are no-ops"
    )]
    fn on_gltf_primitive(
        &mut self,
        load_context: &mut LoadContext<'_>,
        gltf_document: &gltf::Gltf,
        gltf_primitive: &gltf::Primitive,
        buffer_data: &[Vec<u8>],
        out_doc: &mut Option<gltf::Document>,
        out_data: &mut Option<Vec<Vec<u8>>>,
    ) {
    }

    /// Called when an individual glTF Mesh is processed
    #[expect(
        unused,
        reason = "default trait implementations do not use the arguments because they are no-ops"
    )]
    fn on_gltf_mesh(
        &mut self,
        load_context: &mut LoadContext<'_>,
        gltf_mesh: &gltf::Mesh,
        mesh: Handle<GltfMesh>,