Rust: refactor pre_emit! and post_emit! to a trait
#19851
Merged
pre_emit! and post_emit! to a trait
#19851