pub struct Client { /* private fields */ }
Expand description
A client for an rsync server.
The client is built with information about the location of the server and what options to use, and then transfer operations can be invoked.
Clients can be parsed from strings:
let client = rsyn::Client::from_str("rsync.example.com::module")
.expect("Parse failed");
Or constructed:
let client = rsyn::Client::local("./src");
let client = rsyn::Client::ssh(Some("user"), "host.example.com", "./src");
Implementations§
Source§impl Client
impl Client
Sourcepub fn local<P: AsRef<Path>>(path: P) -> Client
pub fn local<P: AsRef<Path>>(path: P) -> Client
Builds a Client
that, when connected, starts an rsync --server
subprocess
on the local machine.
This is primarily useful for testing, or copying files locally.
Sourcepub fn ssh(user: Option<&str>, host: &str, path: &str) -> Client
pub fn ssh(user: Option<&str>, host: &str, path: &str) -> Client
Builds a Client
that will connect to an rsync server over ssh.
This will run an external SSH process, defaulting to ssh
, controlled
by Options.ssh_command
.
If user
is None, ssh’s default username, typically the same as the
local user, has effect.
path
is the path on the remote host.
Sourcepub fn mut_options(&mut self) -> &mut Options
pub fn mut_options(&mut self) -> &mut Options
Mutably borrow this client’s Options
.
Sourcepub fn set_options(&mut self, options: Options) -> &mut Self
pub fn set_options(&mut self, options: Options) -> &mut Self
Replace this client’s Options
.
Sourcepub fn set_recursive(&mut self, recursive: bool) -> &mut Self
pub fn set_recursive(&mut self, recursive: bool) -> &mut Self
Set the recursive
option.
Sourcepub fn set_verbose(&mut self, verbose: u32) -> &mut Self
pub fn set_verbose(&mut self, verbose: u32) -> &mut Self
Set the verbose
option.
Sourcepub fn list_files(&mut self) -> Result<(FileList, ServerStatistics)>
pub fn list_files(&mut self) -> Result<(FileList, ServerStatistics)>
List files from the remote server.
This implicitly sets the list_only
option.