multipart_rs/
multipart_type.rsuse std::str::FromStr;
use crate::error::MultipartError;
#[derive(Debug, PartialEq)]
pub enum MultipartType {
FormData,
Mixed,
Alternative,
Digest,
Related,
}
impl FromStr for MultipartType {
type Err = MultipartError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"form-data" => Ok(MultipartType::FormData),
"mixed" => Ok(MultipartType::Mixed),
"alternative" => Ok(MultipartType::Alternative),
"digest" => Ok(MultipartType::Digest),
"related" => Ok(MultipartType::Related),
_ => Err(MultipartError::InvalidMultipartType),
}
}
}