pub struct GitRepository { /* private fields */ }Expand description
支持通过SSH和HTTPS协议访问Git仓库
§Token认证示例
Implementations§
Source§impl GitRepository
impl GitRepository
pub fn repo(&self) -> &String
pub fn tag(&self) -> &Option<String>
pub fn branch(&self) -> &Option<String>
pub fn rev(&self) -> &Option<String>
pub fn path(&self) -> &Option<String>
pub fn ssh_key(&self) -> &Option<String>
pub fn ssh_passphrase(&self) -> &Option<String>
pub fn token(&self) -> &Option<String>
pub fn username(&self) -> &Option<String>
Source§impl GitRepository
impl GitRepository
pub fn set_repo(&mut self, val: String) -> &mut Self
Sourcepub fn set_resource(&mut self, val: Option<String>) -> &mut Self
pub fn set_resource(&mut self, val: Option<String>) -> &mut Self
额外资源标识,例如特定子模块或配置文件
pub fn set_tag(&mut self, val: Option<String>) -> &mut Self
pub fn set_branch(&mut self, val: Option<String>) -> &mut Self
pub fn set_rev(&mut self, val: Option<String>) -> &mut Self
pub fn set_path(&mut self, val: Option<String>) -> &mut Self
pub fn set_ssh_key(&mut self, val: Option<String>) -> &mut Self
pub fn set_ssh_passphrase(&mut self, val: Option<String>) -> &mut Self
pub fn set_token(&mut self, val: Option<String>) -> &mut Self
pub fn set_username(&mut self, val: Option<String>) -> &mut Self
Source§impl GitRepository
impl GitRepository
pub fn from<S: Into<String>>(repo: S) -> Self
pub fn with_tag<S: Into<String>>(self, tag: S) -> Self
pub fn with_opt_tag(self, tag: Option<String>) -> Self
pub fn with_branch<S: Into<String>>(self, branch: S) -> Self
pub fn with_opt_branch(self, branch: Option<String>) -> Self
pub fn with_rev<S: Into<String>>(self, rev: S) -> Self
pub fn with_path<S: Into<String>>(self, path: S) -> Self
pub fn with_ssh_key<S: Into<String>>(self, ssh_key: S) -> Self
pub fn with_ssh_passphrase<S: Into<String>>(self, ssh_passphrase: S) -> Self
pub fn with_token<S: Into<String>>(self, token: S) -> Self
pub fn with_username<S: Into<String>>(self, username: S) -> Self
pub fn with_opt_token(self, token: Option<String>) -> Self
pub fn with_opt_username(self, username: Option<String>) -> Self
Sourcepub fn with_github_token<S: Into<String>>(self, token: S) -> Self
pub fn with_github_token<S: Into<String>>(self, token: S) -> Self
为GitHub设置Token认证(便捷方法) GitHub使用用户名+Token作为密码的方式
Sourcepub fn with_gitlab_token<S: Into<String>>(self, token: S) -> Self
pub fn with_gitlab_token<S: Into<String>>(self, token: S) -> Self
为GitLab设置Token认证(便捷方法) GitLab可以使用“oauth2“作为用户名,Token作为密码
Sourcepub fn with_gitea_token<S: Into<String>>(self, token: S) -> Self
pub fn with_gitea_token<S: Into<String>>(self, token: S) -> Self
为Gitea设置Token认证(便捷方法) Gitea可以使用Token作为密码
Sourcepub fn with_env_token(self, env_var: &str) -> Self
pub fn with_env_token(self, env_var: &str) -> Self
Sourcepub fn with_github_env_token(self) -> Self
pub fn with_github_env_token(self) -> Self
从环境变量读取GitHub Token认证
Sourcepub fn with_gitlab_env_token(self) -> Self
pub fn with_gitlab_env_token(self) -> Self
从环境变量读取GitLab Token认证
Sourcepub fn with_gitea_env_token(self) -> Self
pub fn with_gitea_env_token(self) -> Self
从环境变量读取Gitea Token认证
Sourcepub fn with_git_credentials(self) -> Self
pub fn with_git_credentials(self) -> Self
从~/.git-credentials文件读取token
Trait Implementations§
Source§impl Clone for GitRepository
impl Clone for GitRepository
Source§fn clone(&self) -> GitRepository
fn clone(&self) -> GitRepository
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GitRepository
impl Debug for GitRepository
Source§impl Default for GitRepository
impl Default for GitRepository
Source§fn default() -> GitRepository
fn default() -> GitRepository
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for GitRepository
impl<'de> Deserialize<'de> for GitRepository
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 EnvEvaluable<GitRepository> for GitRepository
impl EnvEvaluable<GitRepository> for GitRepository
fn env_eval(self, dict: &EnvDict) -> GitRepository
Source§impl From<GitRepository> for Address
impl From<GitRepository> for Address
Source§fn from(value: GitRepository) -> Self
fn from(value: GitRepository) -> Self
Converts to this type from the input type.
Source§impl PartialEq for GitRepository
impl PartialEq for GitRepository
Source§impl Serialize for GitRepository
impl Serialize for GitRepository
Source§impl Validate for GitRepository
impl Validate for GitRepository
Source§fn validate(&self) -> ValidationResult
fn validate(&self) -> ValidationResult
验证地址配置
Source§fn is_accessible(&self) -> bool
fn is_accessible(&self) -> bool
验证地址是否可访问
Auto Trait Implementations§
impl Freeze for GitRepository
impl RefUnwindSafe for GitRepository
impl Send for GitRepository
impl Sync for GitRepository
impl Unpin for GitRepository
impl UnsafeUnpin for GitRepository
impl UnwindSafe for GitRepository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConfigIO<T> for Twhere
T: DeserializeOwned + Serialize,
impl<T> ConfigIO<T> for Twhere
T: DeserializeOwned + Serialize,
fn load_conf(path: &Path) -> Result<T, StructError<ConfIOReason>>
fn save_conf(&self, path: &Path) -> Result<(), StructError<ConfIOReason>>
Source§impl<T> ConfigLifecycle for T
impl<T> ConfigLifecycle for T
Source§fn load(path: &str) -> Result<T, StructError<ConfIOReason>>where
T: Sized,
fn load(path: &str) -> Result<T, StructError<ConfIOReason>>where
T: Sized,
强制加载配置文件
Source§fn init(&self, path: &str) -> Result<(), StructError<ConfIOReason>>where
T: Sized,
fn init(&self, path: &str) -> Result<(), StructError<ConfIOReason>>where
T: Sized,
初始化配置文件
Source§fn safe_clean(path: &str) -> Result<(), StructError<ConfIOReason>>
fn safe_clean(path: &str) -> Result<(), StructError<ConfIOReason>>
安全清理配置文件