pub enum TextType {
Text,
Html,
Xhtml,
}Expand description
Text construct type (Atom-style)
Variants§
Implementations§
Source§impl TextType
impl TextType
Sourcepub fn from_type_attr(raw: &str) -> Self
pub fn from_type_attr(raw: &str) -> Self
Determine the text type from an Atom type attribute value.
Per RFC 4287 §3.1.1, the recognized values are text, html, and
xhtml; this also accepts the equivalent MIME spellings (text/html,
application/xhtml+xml) some feeds use in practice. Comparison is
case-insensitive. Any other value maps to Html — fail-closed, so a
bogus or unrecognized type label cannot be used to smuggle content past
downstream HTML sanitization by masquerading as plain text.
§Examples
use feedparser_rs::types::TextType;
assert_eq!(TextType::from_type_attr("text"), TextType::Text);
assert_eq!(TextType::from_type_attr("HTML"), TextType::Html);
assert_eq!(TextType::from_type_attr("text/html"), TextType::Html);
assert_eq!(TextType::from_type_attr("application/xhtml+xml"), TextType::Xhtml);
assert_eq!(TextType::from_type_attr("bogus"), TextType::Html);Trait Implementations§
impl Copy for TextType
impl Eq for TextType
impl StructuralPartialEq for TextType
Auto Trait Implementations§
impl Freeze for TextType
impl RefUnwindSafe for TextType
impl Send for TextType
impl Sync for TextType
impl Unpin for TextType
impl UnsafeUnpin for TextType
impl UnwindSafe for TextType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more