FilesystemMountDefinition

Struct FilesystemMountDefinition 

Source
pub struct FilesystemMountDefinition {
    pub id: String,
    pub host: String,
    pub port: u16,
    pub user: String,
    pub mount_options: Vec<String>,
    pub remote_path: String,
    pub mount_dest_path: Option<String>,
    pub cmd_before_mount: String,
    pub auth_type: AuthType,
    pub ssh_key: String,
}

Fields§

§id: String

Unique identifier for this definition. If mount_dest_path is None, this will also influence where the filesystem gets mounted locally (see local_mount_path()).

§host: String

Hostname or IP address of the remote machine

§port: u16

Port number of the remote machine (e.g. 22).

§user: String

Username to SSH in on the remote machine (e.g. user).

§mount_options: Vec<String>

Mount options to pass to sshfs (-o). Example: [follow_symlinks, rename]

§remote_path: String

Path on the remote server that will be mounted locally (e.g. /storage).

§mount_dest_path: Option<String>

Path where the filesystem will be mounted locally (e.g. /home/user/storage). If not provided, it defaults to {DEFAULT_MOUNT_PATH_PREFIX}/{id}.

§cmd_before_mount: String

Command to run before mounting (e.g. /bin/true)

§auth_type: AuthType

Authentication method. Most of the potential values match SSH’s PreferredAuthentications list, but some are special values that we recognize & handle here.

§ssh_key: String

Path to an SSH private key (e.g. /home/user/.ssh/id_ed25519) for authentication types (like AuthType::PublicKey) that use a key.

Implementations§

Source§

impl FilesystemMountDefinition

Source

pub fn from_json_string(contents: &str) -> Result<Self, Error>

Source

pub fn to_json_string(&self) -> Result<String>

Source

pub fn local_mount_path(&self) -> String

Returns the local mount path for this definition. If mount_dest_path is not None for this definition, it will be used. Otherwise, the default mount path (DEFAULT_MOUNT_PATH_PREFIX) will be used (e.g. /mnt/sshfs/{id}).

Source

pub fn mount_commands(&self) -> Result<Vec<Command>, SftpManError>

Returns a list of commands for mounting the filesystem definition. Mounting is performed via sshfs and ssh commands.

Source

pub fn umount_commands(&self) -> Result<Vec<Command>, SftpManError>

Returns a list of commands for unmounting the filesystem definition.

Unmounting with this command may fail if the filesystem is busy and a fallback mechanism may be necessary (killing the sshfs process responsible for the mount).

Source

pub fn open_command(&self) -> Command

Returns a command that opens a file manager (via xdg-open) at the local mount path (see local_mount_path()).

Opening requires that the filesystem is already mounted.

Trait Implementations§

Source§

impl Clone for FilesystemMountDefinition

Source§

fn clone(&self) -> FilesystemMountDefinition

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 FilesystemMountDefinition

Source§

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

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

impl Default for FilesystemMountDefinition

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for FilesystemMountDefinition

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for FilesystemMountDefinition

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Validate for FilesystemMountDefinition

Source§

impl<'v_a> ValidateArgs<'v_a> for FilesystemMountDefinition

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

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,