You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: code_escape.rs
    path of file: ./repos/genshin_artifact/mona_generate/src/escape
    
    the code of the file until where you have to start completion: use std::fmt::Write;
use askama_escape::Escaper;

pub struct CodeEscaper;

pub fn escape_code(s: &str) -> String {
    let mut x = String::new();
    for c in s.chars() {
        match c {
            '\"' => x.write_str("\\\""),
            '\'' => x.write_str("\\\'"),
            '\\' => x.write_str("\\\\"),
            _ => x.write_char(c)
        }.unwrap();
    }
    x
}

impl Escape
    
    fn write_escaped<W>(&self, mut fmt: W, string: &str) -> std::fmt::Result where W: Write {
        let mut x = String::new();
        for c in string.chars() {
            match c {
                '\"' => x.write_str("\\\""),
                '\'' => x.write_str("\\\'"),
                '\\' => x.write_str("\\\\"),
                _ => x.write_char(c)
            }.unwrap();
        }

        fmt.write_str(&x).unwrap();

        std::fmt::Result::Ok(())
    }