pub struct MapClient<C: BotClient> { /* private fields */ }Expand description
Utility wrapper client that transforms the output of the underlying client.
This is just limited to synchronous transformations over successful results.
In general, it’s recommended to implement the BotClient trait directly for
maximum control instead of using this.
Implementations§
Source§impl<C: BotClient> MapClient<C>
impl<C: BotClient> MapClient<C>
pub fn new(client: C) -> Self
Sourcepub fn set_map_bots(
&mut self,
map: impl FnMut(Vec<Bot>) -> Vec<Bot> + Send + 'static,
)
pub fn set_map_bots( &mut self, map: impl FnMut(Vec<Bot>) -> Vec<Bot> + Send + 'static, )
Sets a transformation function for the list of bots returned by the bots method.
Sourcepub fn set_map_send(
&mut self,
map: impl FnMut(MessageContent) -> MessageContent + Send + 'static,
)
pub fn set_map_send( &mut self, map: impl FnMut(MessageContent) -> MessageContent + Send + 'static, )
Sets a sync transformation function for the successful result of the send method.
Trait Implementations§
Source§impl<C: BotClient + 'static> BotClient for MapClient<C>
impl<C: BotClient + 'static> BotClient for MapClient<C>
Source§fn clone_box(&self) -> Box<dyn BotClient>
fn clone_box(&self) -> Box<dyn BotClient>
Make a boxed dynamic clone of this client to pass around.
Source§fn bots(&self) -> BoxPlatformSendFuture<'static, ClientResult<Vec<Bot>>>
fn bots(&self) -> BoxPlatformSendFuture<'static, ClientResult<Vec<Bot>>>
Interrupt the bot’s current operation.
Bots available under this client.
Source§fn send(
&mut self,
bot_id: &BotId,
messages: &[Message],
tools: &[Tool],
) -> BoxPlatformSendStream<'static, ClientResult<MessageContent>>
fn send( &mut self, bot_id: &BotId, messages: &[Message], tools: &[Tool], ) -> BoxPlatformSendStream<'static, ClientResult<MessageContent>>
Send a message to a bot with support for streamed response. Read more
Source§fn content_widget(
&mut self,
_cx: &mut Cx,
_previous_widget: WidgetRef,
_templates: &HashMap<LiveId, LivePtr>,
_content: &MessageContent,
) -> Option<WidgetRef>
fn content_widget( &mut self, _cx: &mut Cx, _previous_widget: WidgetRef, _templates: &HashMap<LiveId, LivePtr>, _content: &MessageContent, ) -> Option<WidgetRef>
Optionally override how the content of a message is rendered by Makepad. Read more
Auto Trait Implementations§
impl<C> Freeze for MapClient<C>
impl<C> RefUnwindSafe for MapClient<C>
impl<C> Send for MapClient<C>
impl<C> Sync for MapClient<C>
impl<C> Unpin for MapClient<C>
impl<C> UnwindSafe for MapClient<C>
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