I wrote a header file in C meant to be used as an easy library for printing various colors. It has a bunch of constants that the user can use, as well as some functions that they can use to print a line in a specific color>

#define BLACK_FG "\033[30m"
#define RED_FG "\033[31m"
#define GREEN_FG "\033[32m"
#define YELLOW_FG "\033[33m"
#define BLUE_FG "\033[34m"
#define MAGENTA_FG "\033[35m"
#define CYAN_FG "\033[36m"
#define WHITE_FG "\033[37m"
#define DEFAULT_FG "\033[39m"

#define BLACK_BG "\033[40m"
#define RED_BG "\033[41m"
#define GREEN_BG "\033[42m"
#define YELLOW_BG "\033[43m"
#define BLUE_BG "\033[44m"
#define MAGENTA_BG "\033[45m"
#define CYAN_BG "\033[46m"
#define WHITE_BG "\033[47m"
#define DEFAULT_BG "\033[49m"

static inline void print_single_styled_line(char *text, char *fg_color, char *bg_color, int trailing_newlines) {
    printf("%s%s%s", fg_color, bg_color, text);
    for(int i = 0; i < trailing_newlines; i++) printf("\n");
}

So this takes ANSI escape characters and takes in the text to print, as well as foreground and background colors, and sends them to the standard out, then text, then resets them, and prints any new lines specified. What I want to do is port this to Rust. Can you re-implement this, please?
system
maine C main ek header fil likhi thi jiskaa arth vibhinn rangon ko chapai ke liye ek aasaan pustkaalay ke rup main istemaal kiya janaa tha.isamen sthiraank kaa ek samooh he jiskaa upyog upyogkarta kar saktaa he, saath hi kuch fnction jo ve ek vishisht rang main ek line print karne ke liye upyog kar sakate hai>

#define black_fg "\ 033 [30M"
#Define Red_fg "\ 033 [31M"
#Define Green_fg "\ 033 [32M"
#define yellow_fg "\ 033 [33M"
#Define Blue_fg "\ 033 [34M"
#DEFINE MAGENTA_FG "\ 033 [35M"
#DEFINE CYAN_FG "\ 033 [36M"
#Define White_fg "\ 033 [37M"
#define default_fg "\ 033 [39M"

#define black_bg "\ 033 [40M"
#DEFINE RED_BG "\ 033 [41M"
#Define Green_bg "\ 033 [42M"
#define yellow_bg "\ 033 [43M"
#Define Blue_bg "\ 033 [44M"
#DEFINE MAGENTA_BG "\ 033 [45M"
#define cyan_bg "\ 033 [46M"
#Define White_bg "\ 033 [47M"
#define default_bg "\ 033 [49M"

static inline void print_single_styled_line (char *text, char *fg_color, char *bg_color, int traging_newlines) {
    printf ("%s%s%s", fg_color, bg_color, paath);
    for (int i = 0; i <tgring_newlines; i ++) printf ("\ n");
}

to yah ANSI se bachane ke paatro ko le jaataa he or paath main print karne ke liye le jaataa he, saath hi agrabhumi or prishthbhumi rangon ko bhi le jaataa he, or unhen maanak ko baahar bhejtaa he, phir paath, phir unhen riset karata he, or nirdisht kisi bhi nai linon ko print karata he.main jo karnaa chahta hum vah jang ke liye port he.kya aap ise phir se lagu kar sakate hai, kripaya?
user
koi baat nahin.yahan jang main zyaadaatar samakaksh code he:

pub fn print_single_styled_line (paath: & str, fg_color: & str, bg_color: & str, traging_newlines: usize) -> () {
    println! ("{} {}} {}", fg_color, bg_color, text);
    ke liye main 0..trailing_newlines {main
        Println! ("\ n");
    }
}


#[anumati den (non_snake_case)]]
    pub fn mukhya () -> () {
        Black_fg = "\ x1b [30m";
        Let red_fg = "\ x1b [31M";
        GREEN_FG = "\ x1b [32M" ko den;
        chalo yellow_fg = "\ x1b [33m";
        Let blue_fg = "\ x1b [34m";
        Magenta_fg = "\ X1B [35M";
        chalo cyan_fg = "\ x1b [36m";
        light_fg = "\ x1b [37m";
        Default_fg = "\ x1b [39m";
        
        Black_bg = "\ x1b [40m";
        red_bg = "\ x1b [41m";
        Green_bg = "\ x1b [42m";
        chalo yellow_bg = "\ x1b [43m";
        Blue_bg = "\ x1b [44m";
        Magenta_bg = "\ X1B [45M";
        chalo cyan_bg = "\ x1b [46m";
        light_bg = "\ x1b [47m";
        Default_bg = "\ x1b [49m";

        print_single_styled_line ("hello, world!", cyan_fg, yellow_bg, 0);
    }
ANSI escape strings ko rast (octal banaam hex) ke saath kaam karne ke liye shuruyaat main badal diya jaataa he, lekin ve anyathaa samaan hai.haalanki, chetavanee yah he ki rast kaa printlan macro swachaalit rup se ek nai line jodta he, isliye aapke dwaara paarit kii jane vaali nai line aapke dwaara paarit kii jane vaali ek kam hogi.koi nai rekha nahin he.
assistant
<|system|>
</s>
<|user|>
maine C main ek header fil likhi thi jiskaa arth vibhinn rangon ko chapai ke liye ek aasaan pustkaalay ke rup main istemaal kiya janaa tha.isamen sthiraank kaa ek samooh he jiskaa upyog upyogkarta kar saktaa he, saath hi kuch fnction jo ve ek vishisht rang main ek line print karne ke liye upyog kar sakate hai>

#define black_fg "\ 033 [30M"
#Define Red_fg "\ 033 [31M"
#Define Green_fg "\ 033 [32M"
#define yellow_fg "\ 033 [33M"
#Define Blue_fg "\ 033 [34M"
#DEFINE MAGENTA_FG "\ 033 [35M"
#DEFINE CYAN_FG "\ 033 [36M"
#Define White_fg "\ 033 [37M"
#define default_fg "\ 033 [39M"

#define black_bg "\ 033 [40M"
#DEFINE RED_BG "\ 033 [41M"
#Define Green_bg "\ 033 [42M"
#define yellow_bg "\ 033 [43M"
#Define Blue_bg "\ 033 [44M"
#DEFINE MAGENTA_BG "\ 033 [45M"
#define cyan_bg "\ 033 [46M"
#Define White_bg "\ 033 [47M"
#define default_bg "\ 033 [49M"

static inline void print_single_styled_line (char *text, char *fg_color, char *bg_color, int traging_newlines) {
    printf ("%s%s%s", fg_color, bg_color, paath);
    for (int i = 0; i <tgring_newlines; i ++) printf ("\ n");
}

to yah ANSI se bachane ke paatro ko le jaataa he or paath main print karne ke liye le jaataa he, saath hi agrabhumi or prishthbhumi rangon ko bhi le jaataa he, or unhen maanak ko baahar bhejtaa he, phir paath, phir unhen riset karata he, or nirdisht kisi bhi nai linon ko print karata he.main jo karnaa chahta hum vah jang ke liye port he.kya aap ise phir se lagu kar sakate hai, kripaya?</s>
<|assistant|>
koi baat nahin.yahan jang main zyaadaatar samakaksh code he:

pub fn print_single_styled_line (paath: & str, fg_color: & str, bg_color: & str, traging_newlines: usize) -> () {
    println! ("{} {}} {}", fg_color, bg_color, text);
    ke liye main 0..trailing_newlines {main
        Println! ("\ n");
    }
}


#[anumati den (non_snake_case)]]
    pub fn mukhya () -> () {
        Black_fg = "\ x1b [30m";
        Let red_fg = "\ x1b [31M";
        GREEN_FG = "\ x1b [32M" ko den;
        chalo yellow_fg = "\ x1b [33m";
        Let blue_fg = "\ x1b [34m";
        Magenta_fg = "\ X1B [35M";
        chalo cyan_fg = "\ x1b [36m";
        light_fg = "\ x1b [37m";
        Default_fg = "\ x1b [39m";
        
        Black_bg = "\ x1b [40m";
        red_bg = "\ x1b [41m";
        Green_bg = "\ x1b [42m";
        chalo yellow_bg = "\ x1b [43m";
        Blue_bg = "\ x1b [44m";
        Magenta_bg = "\ X1B [45M";
        chalo cyan_bg = "\ x1b [46m";
        light_bg = "\ x1b [47m";
        Default_bg = "\ x1b [49m";

        print_single_styled_line ("hello, world!", cyan_fg, yellow_bg, 0);
    }
ANSI escape strings ko rast (octal banaam hex) ke saath kaam karne ke liye shuruyaat main badal diya jaataa he, lekin ve anyathaa samaan hai.haalanki, chetavanee yah he ki rast kaa printlan macro swachaalit rup se ek nai line jodta he, isliye aapke dwaara paarit kii jane vaali nai line aapke dwaara paarit kii jane vaali ek kam hogi.koi nai rekha nahin he.</s>
