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: literal.rs
    path of file: ./repos/pomsky/pomsky-lib/src/exprs
    
    the code of the file until where you have to start completion: use pomsky_syntax::exprs::Literal;

use crate::{
    compile::{CompileResult, CompileState},
    options::{CompileOptions, RegexFlavor},
    regex::Regex,
};

use super::RuleExt;

impl<'i> RuleExt<'i> for Literal<'i> {
    fn compile<'c>(&'c self, _: CompileOptions, _: &mut CompileState<'c, 'i>) -> CompileResult<'i> {
        Ok(Regex::Literal(self.content.clone()))
    }
}

/// Write a char to the output buffer w
    
pub(crate) fn compile_char(c: char, buf: &mut String, flavor: RegexFlavor) {
    use std::fmt::Write;

    match c {
        '\n' => buf.push_str("\\n"),
        '\r' => buf.push_str("\\r"),
        '\t' => buf.push_str("\\t"),
        '\x0C' => buf.push_str("\\f"),
        // not supported in Rust:
        // '\x1B' => buf.push_str("\\e"),
        // not supported in JS:
        // '\x07' => buf.push_str("\\a"),
        ' ' => buf.push(' '),
        _ if c.is_ascii() => {
            if c.is_ascii_graphic() {
                buf.push(c);
            } else {
                write!(buf, "\\x{:02X}", c as u8).unwrap();
            }
        }
        _ if c.is_alphanumeric() && c.len_utf16() == 1 => {
            buf.push(c);
        }
        _ if c as u32 <= 0xFF && flavor != RegexFlavor::Ruby => {
            write!(buf, "\\x{:02X}", c as u32).unwrap();
        }
        _ if c as u32 <= 0xFFFF && !matches!(flavor, RegexFlavor::Pcre) => {
            write!(buf, "\\u{:04X}", c as u32).unwrap();
        }
        _ if matches!(flavor, RegexFlavor::Python) => {
            write!(buf, "\\U{:08X}", c as u32).unwrap();
        }
        _ if matches!(flavor, RegexFlavor::DotNet) => {
            let mut code_units = [0, 0];
            let encoded = c.encode_utf16(&mut code_units);
            for &mut c in encoded {
                write!(buf, "\\u{:04X}", c).unwrap();
            }
        }
        _ => {
            match flavor {
                RegexFlavor::Pcre | RegexFlavor::Java | RegexFlavor::Ruby => buf.push_str("\\x"),
                _ => buf.push_str("\\u"),
            }
            write!(buf, "{{{:X}}}", c as u32).unwrap();
        }
    }
}