minidom: Make the whole crate almost no_std

Only std::io is still missing, maybe we should consider using a crate
implementing its API on top of no_std?
This commit is contained in:
Emmanuel Gil Peyrot 2025-02-25 01:06:30 +01:00 committed by Link Mauve
commit d203a348cb
7 changed files with 33 additions and 27 deletions

View file

@ -7,6 +7,8 @@
//! A module which exports a few traits for converting types to elements and attributes.
use alloc::string::String;
/// A trait for types which can be converted to an attribute value.
pub trait IntoAttributeValue {
/// Turns this into an attribute string, or None if it shouldn't be added.
@ -17,7 +19,7 @@ macro_rules! impl_into_attribute_value {
($t:ty) => {
impl IntoAttributeValue for $t {
fn into_attribute_value(self) -> Option<String> {
Some(format!("{}", self))
Some(self.to_string())
}
}
};