utf-railroad 1.1.0

Generate text railroad diagrams in rust.
Documentation
  • Coverage
  • 0%
    0 out of 18 items documented0 out of 0 items with examples
  • Size
  • Source code size: 33.38 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 871.55 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • AmberThrall/utf-railroad
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • AmberThrall

UTF Railroad

Generate text railroad diagrams in rust.

Usage

use utf_railroad::{Diagram, Terminal, NonTerminal};

fn main() {
    let diagram = Diagram::default()
        .push(Box::new(Terminal::new("Hello")))
        .push(Box::new(NonTerminal::new("World!")))
        .gap_size(2);

    println!("{}", diagram);
}

Output:

   ╭───────╮  ┏━━━━━━━━┓   
╟──│ Hello │──┃ World! ┃──╢
   ╰───────╯  ┗━━━━━━━━┛   

Examples

JSON Number:

    ╭───╮              ╭───╮               ╭───╮   ╭───────╮      ╭───╮     ╭───╮     ╭───────╮     
╟──┬│ - │┬──┬──────────│ 0 │───────────┬──┬│ . │──┬│ digit │┬┬──┬┬│ e │┬──┬┬│ + │┬┬──┬│ digit │┬┬──╢
   │╰───╯│  │          ╰───╯           │  │╰───╯  │╰───────╯││  ││╰───╯│  ││╰───╯││  │╰───────╯││   
   ╰─────╯  │╭───────────╮   ╭───────╮ │  │       ╰1+ times─╯│  ││╭───╮│  ││╭───╮││  ╰1+ times─╯│   
            ╰│ digit 1-9 │──┬│ digit │┬╯  ╰──────────────────╯  │╰│ E │╯  │╰│ - │╯│             │   
             ╰───────────╯  │╰───────╯│                         │ ╰───╯   │ ╰───╯ │             │   
                            ╰0+ times─╯                         │         ╰───────╯             │   
                                                                ╰───────────────────────────────╯   

Stacked diagrams:

    ╭────────╮  ╭─────────╮  ╭───────╮   ╭────╮  ╭─────╮  ╭────────╮      
╟───│ CREATE │──│ VIRTUAL │──│ TABLE │──┬│ IF │──│ NOT │──│ EXISTS │┬┐┌──╢
    ╰────────╯  ╰─────────╯  ╰───────╯  │╰────╯  ╰─────╯  ╰────────╯│││   
                                        ╰───────────────────────────╯││   
   ┌─────────────────────────────────────────────────────────────────┘│   
   │ ┏━━━━━━━━━━━━━┓  ╭───╮   ┏━━━━━━━━━━━━┓                          │   
   └┬┃ schema-name ┃──│ . │┬──┃ table-name ┃─────────────────────────┐│   
    │┗━━━━━━━━━━━━━┛  ╰───╯│  ┗━━━━━━━━━━━━┛                         ││   
    ╰──────────────────────╯                                         ││   
   ┌─────────────────────────────────────────────────────────────────┘│   
   │╭───────╮  ┏━━━━━━━━━━━━━┓   ╭───╮   ┏━━━━━━━━━━━━━━━━━┓   ╭───╮  │   
   └│ USING │──┃ module-name ┃──┬│ ( │──┬┃ module-argument ┃┬──│ ) │┬─┘   
    ╰───────╯  ┗━━━━━━━━━━━━━┛  │╰───╯  │┗━━━━━━━━━━━━━━━━━┛│  ╰───╯│     
                                │       ╰─────0+ times──────╯       │     
                                ╰───────────────────────────────────╯     

JSON String:

   ╭───╮    ╭──────────────────────────────────────────────────────────╮    ╭───╮   
╟──│ " │──┬┬│ Any unicode character except " or \ or control character │┬┬──│ " │──╢
   ╰───╯  ││╰──────────────────────────────────────────────────────────╯││  ╰───╯   
          ││          ╭───╮               ╭───╮                         ││          
          │╰──────────│ \ │──┬────────────│ " │─────────────┬───────────╯│          
          │           ╰───╯  │            ╰───╯             │            │          
          │                  │            ╭───╮             │            │          
          │                  ├────────────│ \ │─────────────┤            │          
          │                  │            ╰───╯             │            │          
          │                  │            ╭───╮             │            │          
          │                  ├────────────│ / │─────────────┤            │          
          │                  │            ╰───╯             │            │          
          │                  │            ╭───╮             │            │          
          │                  ├────────────│ b │─────────────┤            │          
          │                  │            ╰───╯             │            │          
          │                  │            ╭───╮             │            │          
          │                  ├────────────│ f │─────────────┤            │          
          │                  │            ╰───╯             │            │          
          │                  │            ╭───╮             │            │          
          │                  ├────────────│ n │─────────────┤            │          
          │                  │            ╰───╯             │            │          
          │                  │            ╭───╮             │            │          
          │                  ├────────────│ r │─────────────┤            │          
          │                  │            ╰───╯             │            │          
          │                  │            ╭───╮             │            │          
          │                  ├────────────│ t │─────────────┤            │          
          │                  │            ╰───╯             │            │          
          │                  │╭───╮   ╭───────────────────╮ │            │          
          │                  ╰│ u │──┬│ hexadecimal digit │┬╯            │          
          │                   ╰───╯  │╰───────────────────╯│             │          
          │                          ╰───────4 times───────╯             │          
          ╰───────────────────────────0+ times───────────────────────────╯