Struct protocol_ftp_client::FtpReceiver
[−]
[src]
pub struct FtpReceiver { // some fields omitted }
"Passive" side of FTP protocol, which mean that receiver expects some data from remote server. As soon as it receives enough data it can "advance" to transmitter state, i.e. fill buffer with commands to be further sent to the remote server.
Methods
impl FtpReceiver
[src]
fn new() -> Self
fn try_advance(self, buffer: &[u8]) -> Result<FtpTransmitter, Self>
Try to consume Receiver
by parsing buffer and advance into Transmitter
.
In the case of an error, it returns unmodified Receiver
as the error. The
actually happened error can be obtained via take_error
.
In case of success it remembers the last successful state, probably switches
it and returns Transmitter
object.
fn take_error(&mut self) -> Option<FtpError>
Returns tha last occurred error, and internally
sets up None
.
fn to_transmitter(self) -> FtpTransmitter
Sometimes you need to manually advance to Transmitter
e.g. in case of Authorization Error, you can re-send
other credentials.