Currently Message is constructed ufing fn from_str(blah) which triggers the following warning in clippy:
warning: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str`
--> src\message.rs:19:5
|
19 | / pub fn from_str(source: &'a str) -> Result<Self, Hl7ParseError> {
20 | | //TODO: Try and get this as a std::str::FromStr impl (lifetimes)
21 | |
22 | | let delimiters = str::parse::<Separators>(source)?;
... |
34 | | Ok(msg)
35 | | }
| |_____^
|
= note: `#[warn(clippy::should_implement_trait)]` on by default
= help: consider implementing the trait `std::str::FromStr` or choosing a less ambiguous method name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
Update Message to implement TryFrom<'a str> instead. Note that this will be a breaking API change but simple to resolve by ensuring std::convert::TryFrom is in scope, and replacing the from_str call with try_from.
Currently
Message
is constructed ufingfn from_str(blah)
which triggers the following warning in clippy:Update Message to implement TryFrom<'a str> instead. Note that this will be a breaking API change but simple to resolve by ensuring
std::convert::TryFrom
is in scope, and replacing thefrom_str
call withtry_from
.