xso: deprecate try_from_element

It is not necessary anymore, because we switched from `IntoXml` to
`AsXml`, allowing `transform` to work with a reference instead of
consuming its input.

Before that, `try_from_element` was the only way to fallibly attempt to
parse something from `Element` without having to clone the entire DOM.
This commit is contained in:
Jonas Schäfer 2025-04-27 12:21:42 +02:00
commit c4de8725fc
5 changed files with 50 additions and 66 deletions

View file

@ -510,10 +510,15 @@ pub fn transform<T: FromXml, F: AsXml>(from: &F) -> Result<T, self::error::Error
/// function will return the element unharmed if its element header does not
/// match the expectations of `T`.
#[cfg(feature = "minidom")]
#[deprecated(
since = "0.1.3",
note = "obsolete since the transition to AsXml, which works by reference; use xso::transform instead."
)]
pub fn try_from_element<T: FromXml>(
from: minidom::Element,
) -> Result<T, self::error::FromElementError> {
let mut languages = rxml::xml_lang::XmlLangStack::new();
#[allow(deprecated)]
let (qname, attrs) = minidom_compat::make_start_ev_parts(&from)?;
languages.push_from_attrs(&attrs);