Anders429 / Anders429/word_filter

Use new() method instead of having structs public

Aberta
#68 2 comentários 0 reações 0 responsáveis Ver no GitHub
enhancement
Linguagem predominante
Rust
Estrelas
3
Forks
0
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

Rather than having all of the different internal structs have `public` visibility, it may be possible to use a `new()` method on `WordFilter` to construct it instead. The `new()` method would need to be a `const fn` to be used in `static` context.

The input parameter would just be a fixed-size array of size `N`, with each element being a tuple containing the values needed for a `State`, which are:

- `Flags` - This will be an integer value after #67 is completed.
- `c_transitions` - This will be a closure.
- `aliases` - slice of 2-tuples of references.
- `graphemes` - slice of references.

The references may be a problem, since they reference into the array being constructed in the `new()` method. This may not have to be a problem though, depending on how self-referencing works in const contexts.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.