pub struct ThreadBuilder<T, S = Value> { /* private fields */ }Available on crate feature
client only.Expand description
Configures a thread. build checks history IDs and typed initial state.
Implementations§
Source§impl<T, S> ThreadBuilder<T, S>
impl<T, S> ThreadBuilder<T, S>
Sourcepub fn new(transport: T, thread_id: impl Into<ThreadId>) -> Selfwhere
T: Transport,
pub fn new(transport: T, thread_id: impl Into<ThreadId>) -> Selfwhere
T: Transport,
Configure a thread using any transport.
Sourcepub fn messages(self, messages: impl Into<Vec<Message>>) -> Self
pub fn messages(self, messages: impl Into<Vec<Message>>) -> Self
Existing conversation, checked for duplicate IDs at build time.
Sourcepub fn state(self, state: impl Into<Value>) -> Self
pub fn state(self, state: impl Into<Value>) -> Self
Initial JSON, deserialized to S at build time.
Sourcepub fn context(self, context: impl Into<Vec<Context>>) -> Self
pub fn context(self, context: impl Into<Vec<Context>>) -> Self
Ambient context supplied on each run.
Sourcepub fn forwarded_props(self, props: impl Into<Value>) -> Self
pub fn forwarded_props(self, props: impl Into<Value>) -> Self
Application-specific request properties.
Sourcepub fn protocol_version(self, version: Option<String>) -> Self
pub fn protocol_version(self, version: Option<String>) -> Self
Declares this SDK’s version in each request. Use None only for a
known legacy peer whose request parser predates protocolVersion.
Sourcepub fn diagnostic_limit(self, limit: usize) -> Self
pub fn diagnostic_limit(self, limit: usize) -> Self
Maximum diagnostics retained in each report (default 100).
Sourcepub fn id_generator(
self,
generator: impl FnMut() -> String + Send + 'static,
) -> Self
Available on non-target_family=wasm only.
pub fn id_generator( self, generator: impl FnMut() -> String + Send + 'static, ) -> Self
target_family=wasm only.Inject deterministic IDs for tests. Empty or duplicate IDs are retried up to 64 times.
Sourcepub fn build(self) -> Result<Thread<T, S>>where
S: DeserializeOwned,
pub fn build(self) -> Result<Thread<T, S>>where
S: DeserializeOwned,
Validate state and history, then construct the conversation.
Trait Implementations§
Auto Trait Implementations§
impl<T, S = Value> !RefUnwindSafe for ThreadBuilder<T, S>
impl<T, S = Value> !Sync for ThreadBuilder<T, S>
impl<T, S = Value> !UnwindSafe for ThreadBuilder<T, S>
impl<T, S> Forget for ThreadBuilder<T, S>
impl<T, S> Freeze for ThreadBuilder<T, S>
impl<T, S> Move for ThreadBuilder<T, S>
impl<T, S> Send for ThreadBuilder<T, S>
impl<T, S> Unpin for ThreadBuilder<T, S>
impl<T, S> UnsafeUnpin for ThreadBuilder<T, S>
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
Mutably borrows from an owned value. Read more