Struct Client

Source
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

Source

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.

Source

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.

Source

pub fn mut_options(&mut self) -> &mut Options

Mutably borrow this client’s Options.

Source

pub fn set_options(&mut self, options: Options) -> &mut Self

Replace this client’s Options.

Source

pub fn set_recursive(&mut self, recursive: bool) -> &mut Self

Set the recursive option.

Source

pub fn set_verbose(&mut self, verbose: u32) -> &mut Self

Set the verbose option.

Source

pub fn list_files(&mut self) -> Result<(FileList, ServerStatistics)>

List files from the remote server.

This implicitly sets the list_only option.

Source

pub fn from_str(s: &str) -> Result<Self>

Builds a Client from a path, URL, or SFTP-like path.

let client = rsyn::Client::from_str("rsync.example.com::module")
    .expect("Parse failed");

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a copy 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 Client

Source§

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

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

impl PartialEq for Client

Source§

fn eq(&self, other: &Client) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Client

Source§

impl StructuralPartialEq for Client

Auto Trait Implementations§

§

impl Freeze for Client

§

impl RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnwindSafe for Client

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> 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.