Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type arguments to compose are horrendous #235

Open
dhdaines opened this issue Feb 14, 2023 · 1 comment
Open

Type arguments to compose are horrendous #235

dhdaines opened this issue Feb 14, 2023 · 1 comment

Comments

@dhdaines
Copy link
Contributor

Not sure if this is rusfst's fault or something inherent to the Rust language, but I really don't feel like it should be necessary to write a straightforward compose operation this way (https://github.com/dhdaines/rustfst-g2p/blob/main/src/g2p.rs#L148):

// fst and self.model are both VectorFst<TropicalWeight>
let fst: VectorFst<TropicalWeight> = compose::<
    TropicalWeight,
    VectorFst<TropicalWeight>,
    VectorFst<TropicalWeight>,
    _,
    _,
    _,
>(fst, &self.model)?;

Is there something that can be done to make rustc properly infer types W, F1, and F2?

@Garvys
Copy link
Owner

Garvys commented Feb 14, 2023

Hello ! For now this is necessary because the rust compiler can't infer the correct types for F1, F2 because of the use of Borrow. I have found a solution for that at the moment 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants