railroad
railroad copied to clipboard
Make more node attributes public or add getter methods
I would like to use this library for rendering railroad diagrams for regular expressions. I would like to be able to use the current types to represent a railroad diagram, but I don't necessarily always want to use them to generate an svg image. I would like to also have the option to render the nodes as a text diagram, for example:
Group 1 ANY
╔══════╗ OF
─┬─╫─abcd─╫─┬─┬a-z┬─
│ ╚══════╝ │ ╰A-Z╯
╰───< <───╯
In order to do this, I was thinking of making my own trait (similar to your Node trait) which would be used for rendering as text. However, I can't implement the trait on your types, because attributes like "text" on Comment are private. I could get around this issue with some work, but I think it would be much easier if I could access the attributes.
Would you be happy to either have attributes (like text) made public, or have some getter methods like
impl Comment {
pub fn text(&self) -> &str {
&self.text
}
}
?
I would be happy to make a PR for this change, if you are happy with one of the above mentioned solutions.