Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

context::InitError is private which makes it annoying to handle. #42

@icefoxen

Description

@icefoxen

I'm not really sure how this is allowed to compile at all, but when I do something like:

impl From<sdl2_ttf::context::InitError> for MyGameError {
    fn from(err: sdl2_ttf::context::InitError) -> MyGameError {
        let s = format!("{}", e);
        MyGameError::TTFError(String::from(s)
    }
}

it doesn't compile because sdl2_ttf::context::InitError is private.

Weirdly, I CAN do this:

fn init_ttf() -> Result<Sdl2TtfContext, MyGameError> {
    match sdl2_ttf::init() {
        Ok(x) => Ok(x),
        Err(e) => Err(GameError::TTFError(format!("{}", e)))
    }
}

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