fix msg type equality bug

This commit is contained in:
glyph 2022-02-26 14:15:27 +02:00
parent 7b78274a52
commit 935347ffcf
1 changed files with 3 additions and 5 deletions

View File

@ -32,7 +32,7 @@ pub struct SsbMessageValue {
}
/// Message content types.
#[derive(Debug)]
#[derive(Debug, PartialEq)]
#[allow(missing_docs)]
pub enum SsbMessageContentType {
About,
@ -70,12 +70,10 @@ impl SsbMessageValue {
/// Helper function which returns `true` if this message is of the given type,
/// and `false` if the type does not match or is not found.
pub fn is_message_type(&self, _message_type: SsbMessageContentType) -> bool {
pub fn is_message_type(&self, message_type: SsbMessageContentType) -> bool {
let self_message_type = self.get_message_type();
match self_message_type {
Ok(mtype) => {
matches!(mtype, _message_type)
}
Ok(mtype) => mtype == message_type,
Err(_err) => false,
}
}