Skip to main content

libunftp/server/controlchan/commands/
noop.rs

1//! The RFC 959 No Operation (`NOOP`) command
2//
3// This command does not affect any parameters or previously
4// entered commands. It specifies no action other than that the
5// server send an OK reply.
6
7use crate::{
8    auth::UserDetail,
9    server::controlchan::{
10        Reply, ReplyCode,
11        error::ControlChanError,
12        handler::{CommandContext, CommandHandler},
13    },
14    storage::{Metadata, StorageBackend},
15};
16use async_trait::async_trait;
17
18#[derive(Debug)]
19pub struct Noop;
20
21#[async_trait]
22impl<Storage, User> CommandHandler<Storage, User> for Noop
23where
24    User: UserDetail + 'static,
25    Storage: StorageBackend<User> + 'static,
26    Storage::Metadata: Metadata,
27{
28    #[tracing_attributes::instrument]
29    async fn handle(&self, _args: CommandContext<Storage, User>) -> Result<Reply, ControlChanError> {
30        Ok(Reply::new(ReplyCode::CommandOkay, "Successfully did nothing"))
31    }
32}