pub struct PresetBuilder { /* private fields */ }Expand description
Fluent builder for IrohServicesPreset. Construct one through
preset or IrohServicesPreset::builder.
Implementations§
Source§impl PresetBuilder
impl PresetBuilder
Sourcepub fn secret_key(self, secret_key: SecretKey) -> Self
pub fn secret_key(self, secret_key: SecretKey) -> Self
Set the endpoint’s long-lived [SecretKey]. If left unset the
endpoint will generate a fresh random key at bind time.
Sourcepub fn relays<I, S>(self, relays: I) -> Result<Self>
pub fn relays<I, S>(self, relays: I) -> Result<Self>
Set relay URLs. This method accepts any iterator of &str, allowing the common pattern:
fn build() -> anyhow::Result<()> {
let _preset = iroh_services::preset()
.relays([
"https://us-east1.project_username.iroh.link",
"https://eu-west1.project_username.iroh.link",
"https://eu-central1.project_username.iroh.link",
])?
.api_secret_from_env()?
.build()?;
Ok(())
}Sourcepub fn relay_mode(self, mode: RelayMode) -> Self
pub fn relay_mode(self, mode: RelayMode) -> Self
Pick relays via a [RelayMode] (e.g. RelayMode::Staging or a
pre-built RelayMode::Custom(RelayMap)).
Sourcepub fn relay_map(self, map: RelayMap) -> Self
pub fn relay_map(self, map: RelayMap) -> Self
Pass in a [RelayMap] directly, bypassing URL parsing.
Sourcepub fn api_secret_from_env(self) -> Result<Self>
pub fn api_secret_from_env(self) -> Result<Self>
Check IROH_SERVICES_API_SECRET environment variable for a valid API secret
Sourcepub fn api_secret_from_str(self, secret_key: &str) -> Result<Self>
pub fn api_secret_from_str(self, secret_key: &str) -> Result<Self>
set client API secret from an encoded string
Sourcepub fn api_secret(self, api_secret: ApiSecret) -> Self
pub fn api_secret(self, api_secret: ApiSecret) -> Self
Stash an ApiSecret on the preset so callers can retrieve it later
via IrohServicesPreset::api_secret when constructing a client.
Sourcepub fn build(self) -> Result<IrohServicesPreset>
pub fn build(self) -> Result<IrohServicesPreset>
Finalize the configuration into an IrohServicesPreset.
Trait Implementations§
Source§impl Clone for PresetBuilder
impl Clone for PresetBuilder
Source§fn clone(&self) -> PresetBuilder
fn clone(&self) -> PresetBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PresetBuilder
impl RefUnwindSafe for PresetBuilder
impl Send for PresetBuilder
impl Sync for PresetBuilder
impl Unpin for PresetBuilder
impl UnwindSafe for PresetBuilder
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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