ApiBuilder

Struct ApiBuilder 

Source
pub struct ApiBuilder<E: FactsEmitter, A: AuditSink> { /* private fields */ }
Expand description

Public API builder. Builder for constructing a Switchyard with ergonomic chaining. Mirrors Switchyard::new(...).with_* but avoids duplication at call sites.

Implementations§

Source§

impl<E: FactsEmitter, A: AuditSink> ApiBuilder<E, A>

Source

pub fn new(facts: E, audit: A, policy: Policy) -> Self

Source

pub fn build(self) -> Switchyard<E, A>

Build a Switchyard with the configured options.

Example

use switchyard::api::ApiBuilder;
use switchyard::policy::Policy;
use switchyard::logging::JsonlSink;

let facts = JsonlSink::default();
let audit = JsonlSink::default();
let api = ApiBuilder::new(facts, audit, Policy::default())
    .with_lock_timeout_ms(500)
    .build();
Source

pub fn with_lock_manager(self, lock: Box<dyn DebugLockManager>) -> Self

Source

pub fn with_ownership_oracle(self, owner: Box<dyn DebugOwnershipOracle>) -> Self

Source

pub fn with_attestor(self, attest: Box<dyn DebugAttestor>) -> Self

Source

pub fn with_smoke_runner(self, smoke: Box<dyn DebugSmokeTestRunner>) -> Self

Source

pub const fn with_lock_timeout_ms(self, timeout_ms: u64) -> Self

Trait Implementations§

Source§

impl<E: Debug + FactsEmitter, A: Debug + AuditSink> Debug for ApiBuilder<E, A>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<E, A> Freeze for ApiBuilder<E, A>
where E: Freeze, A: Freeze,

§

impl<E, A> !RefUnwindSafe for ApiBuilder<E, A>

§

impl<E, A> Send for ApiBuilder<E, A>
where E: Send, A: Send,

§

impl<E, A> Sync for ApiBuilder<E, A>
where E: Sync, A: Sync,

§

impl<E, A> Unpin for ApiBuilder<E, A>
where E: Unpin, A: Unpin,

§

impl<E, A> !UnwindSafe for ApiBuilder<E, A>

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
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.