ruma / homeserver

A Matrix homeserver written in Rust.
https://www.ruma.io/
1.08k stars 41 forks source link

Convert a String to an EventType doesn't work correct. #95

Closed farodin91 closed 8 years ago

farodin91 commented 8 years ago

from_str(&self.event_type)? https://github.com/ruma/ruma/blob/master/src/event.rs#L180

For example: "m.room.join_rules" => Err(Syntax(ExpectedSomeValue,1,1)) "\"m.room.join_rules\"" => Ok(EventType::RoomJoinRules)

jimmycuadra commented 8 years ago

That's expected behavior, because the from_str API is for converting from JSON, which includes literal double quotes around string values. What you actually want here is an implementation of std::str::FromStr, which would need to be implemented in ruma-events. I'm gonna close this and open an issue over there to do that.