Skip to main content

FtpBuilder

Struct FtpBuilder 

Source
pub struct FtpBuilder { /* private fields */ }
Expand description

Builder for FTP control connection messages (commands and replies).

Implementations§

Source§

impl FtpBuilder

Source

pub fn new() -> Self

Source

pub fn reply(self, code: u16, text: impl Into<String>) -> Self

Set the reply code and message text.

Source

pub fn multiline(self, lines: Vec<String>) -> Self

Make this a multi-line reply with additional intermediate lines.

Source

pub fn service_ready(self, text: impl Into<String>) -> Self

Build “220 Service ready” reply.

Source

pub fn user_logged_in(self, text: impl Into<String>) -> Self

Build “230 User logged in” reply.

Source

pub fn password_required(self) -> Self

Build “331 Password required” reply.

Source

pub fn passive_mode( self, h1: u8, h2: u8, h3: u8, h4: u8, p1: u8, p2: u8, ) -> Self

Build “227 Entering Passive Mode” reply.

Source

pub fn extended_passive_mode(self, port: u16) -> Self

Build “229 Entering Extended Passive Mode” reply.

Source

pub fn transfer_complete(self) -> Self

Build “226 Transfer complete” reply.

Source

pub fn file_status_ok(self) -> Self

Build “150 File status okay” reply.

Source

pub fn file_action_ok(self) -> Self

Build “250 Requested file action OK” reply.

Source

pub fn pathname_created(self, path: impl Into<String>) -> Self

Build “257 pathname created” reply.

Source

pub fn goodbye(self) -> Self

Build “221 Goodbye” reply.

Source

pub fn service_not_available(self) -> Self

Build “421 Service not available” reply.

Source

pub fn not_logged_in(self) -> Self

Build “530 Not logged in” reply.

Source

pub fn file_unavailable(self, text: impl Into<String>) -> Self

Build “550 File unavailable” reply.

Source

pub fn syntax_error(self, text: impl Into<String>) -> Self

Build “500 Syntax error” reply.

Source

pub fn feat_reply(self, features: Vec<String>) -> Self

Build a FEAT reply (RFC 2389 feature list).

Source

pub fn command(self, verb: impl Into<String>, args: impl Into<String>) -> Self

Set a raw command verb and optional args.

Source

pub fn user(self, username: impl Into<String>) -> Self

Build “USER ” command.

Source

pub fn pass(self, password: impl Into<String>) -> Self

Build “PASS ” command.

Source

pub fn quit(self) -> Self

Build “QUIT” command.

Source

pub fn list(self, path: impl Into<String>) -> Self

Build “LIST [path]” command.

Source

pub fn nlst(self, path: impl Into<String>) -> Self

Build “NLST [path]” command.

Source

pub fn retr(self, filename: impl Into<String>) -> Self

Build “RETR ” command.

Source

pub fn stor(self, filename: impl Into<String>) -> Self

Build “STOR ” command.

Source

pub fn appe(self, filename: impl Into<String>) -> Self

Build “APPE ” command.

Source

pub fn dele(self, filename: impl Into<String>) -> Self

Build “DELE ” command.

Source

pub fn cwd(self, path: impl Into<String>) -> Self

Build “CWD ” command.

Source

pub fn cdup(self) -> Self

Build “CDUP” command.

Source

pub fn mkd(self, path: impl Into<String>) -> Self

Build “MKD ” command.

Source

pub fn rmd(self, path: impl Into<String>) -> Self

Build “RMD ” command.

Source

pub fn pwd(self) -> Self

Build “PWD” command.

Source

pub fn syst(self) -> Self

Build “SYST” command.

Source

pub fn noop(self) -> Self

Build “NOOP” command.

Source

pub fn pasv(self) -> Self

Build “PASV” command.

Source

pub fn epsv(self) -> Self

Build “EPSV” command.

Source

pub fn port(self, h1: u8, h2: u8, h3: u8, h4: u8, p1: u8, p2: u8) -> Self

Build “PORT h1,h2,h3,h4,p1,p2” command.

Source

pub fn type_cmd(self, mode: char) -> Self

Build “TYPE ” command (A=ASCII, I=binary).

Source

pub fn feat(self) -> Self

Build “FEAT” command.

Source

pub fn size(self, filename: impl Into<String>) -> Self

Build “SIZE ” command (RFC 3659).

Source

pub fn mdtm(self, filename: impl Into<String>) -> Self

Build “MDTM ” command (RFC 3659).

Source

pub fn auth(self, mechanism: impl Into<String>) -> Self

Build “AUTH ” command.

Source

pub fn rnfr(self, filename: impl Into<String>) -> Self

Build “RNFR ” command.

Source

pub fn rnto(self, filename: impl Into<String>) -> Self

Build “RNTO ” command.

Source

pub fn rest(self, offset: u64) -> Self

Build “REST ” command.

Source

pub fn abor(self) -> Self

Build “ABOR” command.

Source

pub fn stat(self, path: impl Into<String>) -> Self

Build “STAT [path]” command.

Source

pub fn help(self, topic: impl Into<String>) -> Self

Build “HELP [topic]” command.

Source

pub fn build(&self) -> Vec<u8>

Serialize this FTP message to bytes (including CRLF terminator).

Trait Implementations§

Source§

impl Clone for FtpBuilder

Source§

fn clone(&self) -> FtpBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FtpBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FtpBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V