1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-26 01:04:35 +02:00

Further simplify Box diagrams (#409)

* Further simplify `Box` diagrams

I think we can improve the drawing by simplifying them and making them
more symbolic. Followup to #374.

* Apply suggestions from code review
This commit is contained in:
Martin Geisler 2023-02-15 19:10:50 +01:00 committed by GitHub
parent 14b5e86579
commit f16b41f012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 13 deletions

View File

@ -18,15 +18,13 @@ allows the compiler to optimize the memory layout:
```bob ```bob
Stack Heap Stack Heap
.- - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - -. .- - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - -.
: : : : : : : :
: list : : : : list : : :
: +----+----------+ : : +----+----------+ +----+----------+ : : +----+----+ : : +----+----+ +----+------+ :
: | .0 | ".1/Tag" | : : | .0 | ".1/Tag" | | .0 | ".1/Tag" | : : | 1 | o--+-----------+-----+--->| 2 | o--+--->| // | null | :
: +----+----------+ : : +----+----------+ +----+----------+ : : +----+----+ : : +----+----+ +----+------+ :
: | 1 | o-----+---+-----+--->| 1 | o-----+--->| 2 | null | : : : : :
: +----+----------+ : : +----+----------+ +----+----------+ : : : : :
: : : : `- - - - - - - - - - - - -' '- - - - - - - - - - - - - - - - - - - - - - -'
: : : :
`- - - - - - - - - - - -' '- - - - - - - - - - - - - - - - - - - - - - -'
``` ```

View File

@ -21,8 +21,6 @@ fn main() {
: : : : : : : :
: list : : : : list : : :
: +------+----+----+ : : +------+----+----+ +------+----+----+ : : +------+----+----+ : : +------+----+----+ +------+----+----+ :
: | Tag | .0 | .1 | : : | Tag | .0 | .1 | | Tag | .0 | .1 | :
: +------+----+----+ : : +------+----+----+ +------+----+----+ :
: | Cons | 1 | o--+----+-----+--->| Cons | 2 | o--+--->| Nil | // | // | : : | Cons | 1 | o--+----+-----+--->| Cons | 2 | o--+--->| Nil | // | // | :
: +------+----+----+ : : +------+----+----+ +------+----+----+ : : +------+----+----+ : : +------+----+----+ +------+----+----+ :
: : : : : : : :