pub struct BotContext(/* private fields */);Expand description
A sharable wrapper around a BotClient that holds loadeed bots and provides synchronous APIs to access them, mainly from the UI.
Passed down through widgets from this crate.
Separate chat widgets can share the same BotContext to avoid loading the same bots multiple times.
Implementations§
Source§impl BotContext
impl BotContext
Sourcepub fn id(&self) -> usize
pub fn id(&self) -> usize
Differenciates BotContexts.
Two BotContexts are equal and share the same underlying data if they have the same id.
Sourcepub fn load(&mut self) -> BoxPlatformSendFuture<'_, ClientResult<()>>
pub fn load(&mut self) -> BoxPlatformSendFuture<'_, ClientResult<()>>
Fetches the bots and keeps them to be read synchronously later.
It errors with whatever the underlying client errors with.
pub fn client(&self) -> Box<dyn BotClient>
pub fn bots(&self) -> Vec<Bot>
pub fn get_bot(&self, id: &BotId) -> Option<Bot>
pub fn tool_manager(&self) -> Option<McpManagerClient>
pub fn set_tool_manager(&mut self, tool_manager: McpManagerClient)
pub fn replace_tool_manager(&mut self, tool_manager: McpManagerClient)
Trait Implementations§
Source§impl Clone for BotContext
impl Clone for BotContext
Source§impl<T: BotClient + 'static> From<T> for BotContext
impl<T: BotClient + 'static> From<T> for BotContext
Source§impl PartialEq for BotContext
impl PartialEq for BotContext
Auto Trait Implementations§
impl Freeze for BotContext
impl RefUnwindSafe for BotContext
impl Send for BotContext
impl Sync for BotContext
impl Unpin for BotContext
impl UnwindSafe for BotContext
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