Skip to content

Commit 068167a

Browse files
committed
Implement a simple graph
using a vector and a map to keep the nodes and the edges
1 parent 59dd59d commit 068167a

File tree

2 files changed

+536
-4
lines changed

2 files changed

+536
-4
lines changed

src/translator.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use std::collections::{HashMap, HashSet};
22

3-
use trie::Trie;
3+
use graph::Graph;
44

55
use crate::parser::{dots_to_unicode, fallback, AnchoredRule, Attribute, Braille, Direction, Rule};
66

7-
use self::trie::Boundary;
7+
use self::graph::Boundary;
88

99
mod boundaries;
10+
mod graph;
1011
mod trie;
1112

1213
#[derive(thiserror::Error, Debug, PartialEq)]
@@ -158,7 +159,7 @@ pub struct TranslationTable {
158159
undefined: Option<String>,
159160
character_definitions: CharacterDefinition,
160161
character_attributes: CharacterAttributes,
161-
translations: Trie,
162+
translations: Graph,
162163
direction: Direction,
163164
}
164165

@@ -170,7 +171,7 @@ impl TranslationTable {
170171
let mut undefined = None;
171172
let mut character_definitions = CharacterDefinition::new();
172173
let mut character_attributes = CharacterAttributes::new();
173-
let mut translations = Trie::new();
174+
let mut translations = Graph::new();
174175

175176
let rules: Vec<AnchoredRule> = rules
176177
.into_iter()

0 commit comments

Comments
 (0)