forked from lavina/lavina
1
0
Fork 0

renamed trait name

This commit is contained in:
homycdev 2024-04-23 21:16:18 +03:00
parent 37fbe989b0
commit 67fbcc0c41
5 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
use lavina_core::prelude::Str; use lavina_core::prelude::Str;
use lavina_core::repo::Storage; use lavina_core::repo::Storage;
use proto_irc::response::SendResponse; use proto_irc::response::WriteResponse;
use std::future::Future; use std::future::Future;
use tokio::io::AsyncWrite; use tokio::io::AsyncWrite;

View File

@ -1,7 +1,7 @@
use tokio::io::{AsyncWrite, AsyncWriteExt}; use tokio::io::{AsyncWrite, AsyncWriteExt};
use lavina_core::prelude::Str; use lavina_core::prelude::Str;
use proto_irc::response::SendResponse; use proto_irc::response::WriteResponse;
/// ERR_NOSUCHNICK (401) /// ERR_NOSUCHNICK (401)
pub struct ErrNoSuchNick401 { 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<()> { async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
writer.write_all(b"401 ").await?; writer.write_all(b"401 ").await?;
writer.write_all(self.client.as_bytes()).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<()> { async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
writer.write_all(b"431").await?; writer.write_all(b"431").await?;
writer.write_all(self.client.as_bytes()).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<()> { async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
writer.write_all(b"402 ").await?; writer.write_all(b"402 ").await?;
writer.write_all(self.client.as_bytes()).await?; writer.write_all(self.client.as_bytes()).await?;

View File

@ -4,7 +4,7 @@ use tracing::instrument::WithSubscriber;
use lavina_core::prelude::Str; use lavina_core::prelude::Str;
use lavina_core::repo::Storage; use lavina_core::repo::Storage;
use proto_irc::client::command_args::Whois; 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::error::{ErrNoNicknameGiven431, ErrNoSuchNick401};
use crate::commands::whois::response::{RplWhoIsUser311, RPL_ENDOFWHOIS_318}; use crate::commands::whois::response::{RplWhoIsUser311, RPL_ENDOFWHOIS_318};

View File

@ -1,7 +1,7 @@
use tokio::io::{AsyncWrite, AsyncWriteExt}; use tokio::io::{AsyncWrite, AsyncWriteExt};
use lavina_core::prelude::Str; use lavina_core::prelude::Str;
use proto_irc::response::SendResponse; use proto_irc::response::WriteResponse;
struct RplWhoisCertfp276; struct RplWhoisCertfp276;
struct RplWhoisRegNick307; 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<()> { async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
writer.write_all(b"311 ").await?; writer.write_all(b"311 ").await?;
writer.write_all(self.client.as_bytes()).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<()> { async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
writer.write_all(b"318 ").await?; writer.write_all(b"318 ").await?;
writer.write_all(self.client.as_bytes()).await?; writer.write_all(self.client.as_bytes()).await?;

View File

@ -5,7 +5,7 @@ use tokio::io::{AsyncWrite, AsyncWriteExt};
use crate::prelude::Str; use crate::prelude::Str;
use crate::Tag; use crate::Tag;
pub trait SendResponse { pub trait WriteResponse {
fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> impl Future<Output = std::io::Result<()>>; 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<()> { async fn write_response(self, writer: &mut (impl AsyncWrite + Unpin)) -> std::io::Result<()> {
if let Some(sender) = &self.sender { if let Some(sender) = &self.sender {
writer.write_all(b":").await?; writer.write_all(b":").await?;