Annotation For src/utils.rs
Logged in as anonymous

Lines of src/utils.rs from check-in dafeec0481 that are changed by the sequence of edits moving toward check-in 85fa6bddaa:

                         1: use crate::Cursor;
                         2: 
                         3: use lazy_static::lazy_static;
                         4: use regex::Regex;
                         5: use stacked_errors::{
                         6: 	bail,
                         7: 	Result,
                         8: };
                         9: 
                        10: lazy_static! {
                        11: 	pub static ref RE_DOMAIN: Regex = Regex::new(r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$").unwrap();
                        12: 	pub static ref RE_CLOSING: Regex = Regex::new(r"</[ \t]*(pre|code)[ \t]*>").unwrap();
                        13: }
                        14: 
                        15: /// `Attachment` object to store number attachment data and corresponding file name
                        16: #[derive(Debug)]
                        17: pub struct Attachment {
                        18: 	pub data: Cursor<Vec<u8>>,
                        19: 	pub name: String,
                        20: }
                        21: 
                        22: /// Pass any text here to be validated as not breaking from Telegram preformatted blocks
dafeec0481 2026-01-18   23: pub fn validate (text: &str) -> Result<&str> {
                        24: 	if RE_CLOSING.is_match(text) {
                        25: 		bail!("Telegram closing tag found.");
                        26: 	} else {
dafeec0481 2026-01-18   27: 		Ok(text)
                        28: 	}
                        29: }