I wish I knew Rust so I could fully appreciate this unethical code.
Terminal handling is a cursed realm. This project is basically all terminal handling, done in a place where no terminal is allowed to exist, and interacting with a badly documented environment that really does not wish it to exist. There are probably some unsafe blocks, but I don't believe the code itself is the extraordinary part.
It would be interesting to split Bash into a front end and back end, with the ability to plug different protocols in between.