forked from lavina/lavina
renamed trait name
This commit is contained in:
parent
37fbe989b0
commit
67fbcc0c41
|
@ -1,6 +1,6 @@
|
|||
use lavina_core::prelude::Str;
|
||||
use lavina_core::repo::Storage;
|
||||
use proto_irc::response::SendResponse;
|
||||
use proto_irc::response::WriteResponse;
|
||||
use std::future::Future;
|
||||
use tokio::io::AsyncWrite;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||
|
||||
use lavina_core::prelude::Str;
|
||||
use proto_irc::response::SendResponse;
|
||||
use proto_irc::response::WriteResponse;
|
||||
|
||||
/// ERR_NOSUCHNICK (401)
|
||||
pub struct ErrNoSuchNick401 {
|
||||
|
@ -33,7 +33,7 @@ impl ErrNoNicknameGiven431 {
|
|||
}
|
||||
}
|
||||
|
||||
impl SendResponse for ErrNoSuchNick401 {
|
||||
impl WriteResponse for ErrNoSuchNick401 {
|
||||
async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
|
||||
writer.write_all(b"401 ").await?;
|
||||
writer.write_all(self.client.as_bytes()).await?;
|
||||
|
@ -45,7 +45,7 @@ impl SendResponse for ErrNoSuchNick401 {
|
|||
}
|
||||
}
|
||||
|
||||
impl SendResponse for ErrNoNicknameGiven431 {
|
||||
impl WriteResponse for ErrNoNicknameGiven431 {
|
||||
async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
|
||||
writer.write_all(b"431").await?;
|
||||
writer.write_all(self.client.as_bytes()).await?;
|
||||
|
@ -55,7 +55,7 @@ impl SendResponse for ErrNoNicknameGiven431 {
|
|||
}
|
||||
}
|
||||
|
||||
impl SendResponse for ErrNoSuchServer402 {
|
||||
impl WriteResponse for ErrNoSuchServer402 {
|
||||
async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
|
||||
writer.write_all(b"402 ").await?;
|
||||
writer.write_all(self.client.as_bytes()).await?;
|
||||
|
|
|
@ -4,7 +4,7 @@ use tracing::instrument::WithSubscriber;
|
|||
use lavina_core::prelude::Str;
|
||||
use lavina_core::repo::Storage;
|
||||
use proto_irc::client::command_args::Whois;
|
||||
use proto_irc::response::{IrcResponseMessage, SendResponse};
|
||||
use proto_irc::response::{IrcResponseMessage, WriteResponse};
|
||||
|
||||
use crate::commands::whois::error::{ErrNoNicknameGiven431, ErrNoSuchNick401};
|
||||
use crate::commands::whois::response::{RplWhoIsUser311, RPL_ENDOFWHOIS_318};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||
|
||||
use lavina_core::prelude::Str;
|
||||
use proto_irc::response::SendResponse;
|
||||
use proto_irc::response::WriteResponse;
|
||||
|
||||
struct RplWhoisCertfp276;
|
||||
struct RplWhoisRegNick307;
|
||||
|
@ -47,7 +47,7 @@ impl RPL_ENDOFWHOIS_318 {
|
|||
}
|
||||
}
|
||||
|
||||
impl SendResponse for RplWhoIsUser311 {
|
||||
impl WriteResponse for RplWhoIsUser311 {
|
||||
async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
|
||||
writer.write_all(b"311 ").await?;
|
||||
writer.write_all(self.client.as_bytes()).await?;
|
||||
|
@ -70,7 +70,7 @@ impl SendResponse for RplWhoIsUser311 {
|
|||
}
|
||||
}
|
||||
|
||||
impl SendResponse for RPL_ENDOFWHOIS_318 {
|
||||
impl WriteResponse for RPL_ENDOFWHOIS_318 {
|
||||
async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
|
||||
writer.write_all(b"318 ").await?;
|
||||
writer.write_all(self.client.as_bytes()).await?;
|
||||
|
|
|
@ -5,7 +5,7 @@ use tokio::io::{AsyncWrite, AsyncWriteExt};
|
|||
use crate::prelude::Str;
|
||||
use crate::Tag;
|
||||
|
||||
pub trait SendResponse {
|
||||
pub trait WriteResponse {
|
||||
fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> impl Future<Output = std::io::Result<()>>;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ impl<T> IrcResponseMessage<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: SendResponse> SendResponse for IrcResponseMessage<T> {
|
||||
impl<T: WriteResponse> WriteResponse for IrcResponseMessage<T> {
|
||||
async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
|
||||
if let Some(sender) = &self.sender {
|
||||
writer.write_all(b":").await?;
|
||||
|
|
Loading…
Reference in New Issue