yazi/yazi-shared/src/auth/kind.rs
三咲雅 misaki masa 1f85b1a2bf
feat: new hub VFS kind
2026-07-17 02:30:46 +08:00

43 lines
861 B
Rust

use serde::Deserialize;
use strum::{EnumString, IntoStaticStr};
#[derive(
Clone, Copy, Debug, Default, Deserialize, EnumString, Eq, Hash, IntoStaticStr, PartialEq,
)]
#[serde(rename_all = "lowercase")]
#[strum(serialize_all = "lowercase")]
pub enum AuthKind {
#[default]
Regular,
Search,
Mount,
Hub,
Scope,
Sftp,
}
impl AuthKind {
#[inline]
pub fn is_local(self) -> bool {
match self {
Self::Regular | Self::Search => true,
Self::Mount | Self::Hub | Self::Scope | Self::Sftp => false,
}
}
#[inline]
pub fn is_remote(self) -> bool {
match self {
Self::Regular | Self::Search | Self::Mount => false,
Self::Hub | Self::Scope | Self::Sftp => true,
}
}
#[inline]
pub fn is_virtual(self) -> bool {
match self {
Self::Regular | Self::Search => false,
Self::Mount | Self::Hub | Self::Scope | Self::Sftp => true,
}
}
}