Struct gitforge::forge::Config[][src]

pub struct Config {
    pub token: Option<TokenConfig>,
    pub kind: Option<Kind>,
    pub host: String,
    pub _non_exhaustive: (),
}
Expand description

Instructions for how to connect to a forge

Fields

token: Option<TokenConfig>

Access token (secret).

If left as None, Config::forge() will do the work of load_default_token.

kind: Option<Kind>

The kind of forge (ie, the protocol to speak).

Currently, None is not supported. In the future omitting kind might result in auto-guessing from host.

host: String

Hostname.

Eg, gitlab.com, github.com, salsa.debian.org.

_non_exhaustive: ()

Do not specify this field. Instead, say ..Default::default(). New fields may be added and this will not be considered a semver break.

Implementations

Main constructor for a Forge

Calculate the default path for finding a secret token.

On Unix this is ~/.config/gitforge/FORGE_EXAMPLE_ORG.KIND-token where FORGE_EXAMPLE_ORG is host with dots replaced with underscores.

Load the default token, updating this Config.

It is not normally necessary to call this, because Config::new() will automatically laod and use the appropriate token anyway, according to the same algorithm.

Arranges that self.token is either Anonymous or Value, by establishing a suitable default, and loading the token from a file, as necessary.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.