pub struct Provider {
pub address: String,
pub model: String,
pub key_file: String,
pub key_header: String,
pub source: Source,
}Expand description
The provider as the settings describe it. Every field is what the person wrote, trimmed.
Fields§
§address: StringThe address the Messages API lives under.
model: StringThe model asked for.
key_file: StringThe path of the key file, as written: ~/ stands for the home folder.
key_header: StringThe header the key goes in.
source: SourceWhere all this was described.
Implementations§
Source§impl Provider
impl Provider
Sourcepub fn from_settings(settings: &Settings) -> Self
pub fn from_settings(settings: &Settings) -> Self
The provider in settings.
Sourcepub fn from_environment(
read: impl Fn(&str) -> Option<String>,
) -> Result<Option<Self>, ProfileError>
pub fn from_environment( read: impl Fn(&str) -> Option<String>, ) -> Result<Option<Self>, ProfileError>
The provider a QCode profile describes in the environment read gives, None when it
describes none, which is qcli started anywhere but in a QCode tab.
§Errors
When only one of the two variables is set, or the address is not one of this machine.
Sourcepub fn write(&self, settings: &mut Settings)
pub fn write(&self, settings: &mut Settings)
Writes the provider into settings. A header that is the default is not written, the
way the ecosystem writes no default. A provider a QCode profile described is never
written: it is the profile’s, and the person’s own settings stay as they wrote them.
Sourcepub fn missing_field(&self) -> Option<&'static str>
pub fn missing_field(&self) -> Option<&'static str>
The first empty field, if any: the provider cannot be asked without all of them. A profile’s provider has no key file to miss.
Trait Implementations§
impl Eq for Provider
impl StructuralPartialEq for Provider
Auto Trait Implementations§
impl Freeze for Provider
impl RefUnwindSafe for Provider
impl Send for Provider
impl Sync for Provider
impl Unpin for Provider
impl UnsafeUnpin for Provider
impl UnwindSafe for Provider
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more