-
-
Save joepie91/0862349b2e3c2c0e63c07fb9668d9bed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error[E0308]: mismatched types | |
--> src/protocols/irc/types.rs:156:16 | |
| | |
156 | return &self.users; | |
| ^^^^^^^^^^^ expected trait types::user::User, found struct `protocols::irc::types::IRCUser` | |
| | |
= note: expected type `&std::vec::Vec<&dyn types::user::User>` | |
found type `&std::vec::Vec<&'a protocols::irc::types::IRCUser<'a>>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::types::User; | |
pub trait Room { | |
fn name(&self) -> String; | |
fn display_name(&self) -> String; | |
fn topic(&self) -> Option<String>; | |
fn identifier(&self) -> String; | |
fn users(&self) -> &Vec<&User>; | |
} | |
// ... | |
pub struct IRCChannel<'a> { | |
network: &'a IRCNetwork<'a>, | |
name: String, | |
topic: Option<String>, | |
users: Vec<&'a IRCUser<'a>> | |
} | |
// ... | |
impl<'a> Room for IRCChannel<'a> { | |
fn name(&self) -> String { | |
return self.name; | |
} | |
fn display_name(&self) -> String { | |
return self.name; | |
} | |
fn topic(&self) -> Option<String> { | |
return self.topic; | |
} | |
fn identifier(&self) -> String { | |
return format!("channel:{}@{}", self.name(), self.network.identifier()); | |
} | |
fn users(&self) -> &Vec<&User> { | |
return &self.users; | |
} | |
} | |
// ... | |
impl<'a> User for IRCUser<'a> { | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment