Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error handling #12

@ghost

Description

Currently the function ktx::Ktx::new panics if an invalid file is provided:

fn main() {
    unsafe {
        ktx::Ktx::new(std::fs::read("/home/fctorial/.zshrc").unwrap());
    }
}

What should I do if I'm trying to load an unknown ktx file, for example, a file that I'm receiving over the network. Is there another function that returns an std::error::Error if the provided file is invalid? Does the library currently perform sanity checks on the input file (pixel_height == 0 && pixel_depth != 0 is invalid, numArrayLayers must be zero for 3d images, cubemaps must be 2d)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions