Skip to main content

GitRepository

Struct GitRepository 

Source
pub struct GitRepository { /* private fields */ }
Expand description

支持通过SSH和HTTPS协议访问Git仓库

§Token认证示例

Implementations§

Source§

impl GitRepository

Source

pub fn repo(&self) -> &String

Source

pub fn resource(&self) -> &Option<String>

额外资源标识,例如特定子模块或配置文件

Source

pub fn tag(&self) -> &Option<String>

Source

pub fn branch(&self) -> &Option<String>

Source

pub fn rev(&self) -> &Option<String>

Source

pub fn path(&self) -> &Option<String>

Source

pub fn ssh_key(&self) -> &Option<String>

Source

pub fn ssh_passphrase(&self) -> &Option<String>

Source

pub fn token(&self) -> &Option<String>

Source

pub fn username(&self) -> &Option<String>

Source§

impl GitRepository

Source

pub fn set_repo(&mut self, val: String) -> &mut Self

Source

pub fn set_resource(&mut self, val: Option<String>) -> &mut Self

额外资源标识,例如特定子模块或配置文件

Source

pub fn set_tag(&mut self, val: Option<String>) -> &mut Self

Source

pub fn set_branch(&mut self, val: Option<String>) -> &mut Self

Source

pub fn set_rev(&mut self, val: Option<String>) -> &mut Self

Source

pub fn set_path(&mut self, val: Option<String>) -> &mut Self

Source

pub fn set_ssh_key(&mut self, val: Option<String>) -> &mut Self

Source

pub fn set_ssh_passphrase(&mut self, val: Option<String>) -> &mut Self

Source

pub fn set_token(&mut self, val: Option<String>) -> &mut Self

Source

pub fn set_username(&mut self, val: Option<String>) -> &mut Self

Source§

impl GitRepository

Source

pub fn from<S: Into<String>>(repo: S) -> Self

Source

pub fn with_tag<S: Into<String>>(self, tag: S) -> Self

Source

pub fn with_opt_tag(self, tag: Option<String>) -> Self

Source

pub fn with_branch<S: Into<String>>(self, branch: S) -> Self

Source

pub fn with_opt_branch(self, branch: Option<String>) -> Self

Source

pub fn with_rev<S: Into<String>>(self, rev: S) -> Self

Source

pub fn with_path<S: Into<String>>(self, path: S) -> Self

Source

pub fn with_ssh_key<S: Into<String>>(self, ssh_key: S) -> Self

Source

pub fn with_ssh_passphrase<S: Into<String>>(self, ssh_passphrase: S) -> Self

Source

pub fn with_token<S: Into<String>>(self, token: S) -> Self

Source

pub fn with_username<S: Into<String>>(self, username: S) -> Self

Source

pub fn with_opt_token(self, token: Option<String>) -> Self

Source

pub fn with_opt_username(self, username: Option<String>) -> Self

Source

pub fn with_github_token<S: Into<String>>(self, token: S) -> Self

为GitHub设置Token认证(便捷方法) GitHub使用用户名+Token作为密码的方式

Source

pub fn with_gitlab_token<S: Into<String>>(self, token: S) -> Self

为GitLab设置Token认证(便捷方法) GitLab可以使用“oauth2“作为用户名,Token作为密码

Source

pub fn with_gitea_token<S: Into<String>>(self, token: S) -> Self

为Gitea设置Token认证(便捷方法) Gitea可以使用Token作为密码

Source

pub fn with_env_token(self, env_var: &str) -> Self

从环境变量读取Token认证

§Arguments
  • env_var - 环境变量名,例如 “GITHUB_TOKEN”
Source

pub fn with_github_env_token(self) -> Self

从环境变量读取GitHub Token认证

Source

pub fn with_gitlab_env_token(self) -> Self

从环境变量读取GitLab Token认证

Source

pub fn with_gitea_env_token(self) -> Self

从环境变量读取Gitea Token认证

Source

pub fn with_git_credentials(self) -> Self

从~/.git-credentials文件读取token

Source

pub fn read_git_credentials() -> Option<Vec<(String, String, String)>>

读取~/.git-credentials文件

Trait Implementations§

Source§

impl Clone for GitRepository

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for GitRepository

Source§

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

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

impl Default for GitRepository

Source§

fn default() -> GitRepository

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

impl<'de> Deserialize<'de> for GitRepository

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 EnvEvaluable<GitRepository> for GitRepository

Source§

impl From<GitRepository> for Address

Source§

fn from(value: GitRepository) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for GitRepository

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for GitRepository

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 GitRepository

Source§

fn validate(&self) -> ValidationResult

验证地址配置
Source§

fn is_accessible(&self) -> bool

验证地址是否可访问

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> ConfigIO<T> for T

Source§

impl<T> ConfigLifecycle for T

Source§

fn load(path: &str) -> Result<T, StructError<ConfIOReason>>
where T: Sized,

强制加载配置文件
Source§

fn init(&self, path: &str) -> Result<(), StructError<ConfIOReason>>
where T: Sized,

初始化配置文件
Source§

fn safe_clean(path: &str) -> Result<(), StructError<ConfIOReason>>

安全清理配置文件
Source§

fn save(&self, path: &str) -> Result<(), StructError<ConfIOReason>>

Source§

fn try_load(path: &str) -> Option<Self>
where Self: Sized,

尝试加载配置文件(安全方法)
Source§

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

Source§

impl<T> EnvTomlLoad<T> for T

Source§

impl<T> EnvYamlLoad<T> for T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> TextConfigIO<T> for T

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> TomlIO<T> for T

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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> YamlIO<T> for T