fix(channels): complete SendMessage migration after rebase
This commit is contained in:
parent
dbebd48dfe
commit
cd0dd13476
7 changed files with 57 additions and 67 deletions
|
|
@ -12,7 +12,7 @@ pub struct ChannelMessage {
|
|||
}
|
||||
|
||||
/// Message to send through a channel
|
||||
#[derive(Debug, Clone, Default)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SendMessage {
|
||||
pub content: String,
|
||||
pub recipient: String,
|
||||
|
|
@ -43,26 +43,6 @@ impl SendMessage {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<&str> for SendMessage {
|
||||
fn from(content: &str) -> Self {
|
||||
Self {
|
||||
content: content.to_string(),
|
||||
recipient: String::new(),
|
||||
subject: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<(String, String)> for SendMessage {
|
||||
fn from(value: (String, String)) -> Self {
|
||||
Self {
|
||||
content: value.0,
|
||||
recipient: value.1,
|
||||
subject: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Core channel trait — implement for any messaging platform
|
||||
#[async_trait]
|
||||
pub trait Channel: Send + Sync {
|
||||
|
|
@ -152,7 +132,10 @@ mod tests {
|
|||
assert!(channel.health_check().await);
|
||||
assert!(channel.start_typing("bob").await.is_ok());
|
||||
assert!(channel.stop_typing("bob").await.is_ok());
|
||||
assert!(channel.send(&SendMessage::new("hello", "bob")).await.is_ok());
|
||||
assert!(channel
|
||||
.send(&SendMessage::new("hello", "bob"))
|
||||
.await
|
||||
.is_ok());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue