pub struct Tools<S> { /* private fields */ }Expand description
The set of tools a plugin is serving.
Implementations§
Source§impl<S> Tools<S>
impl<S> Tools<S>
Sourcepub fn new(routes: impl IntoIterator<Item = ToolRoute<S>>) -> Arc<Self>
pub fn new(routes: impl IntoIterator<Item = ToolRoute<S>>) -> Arc<Self>
The tools to start with — typically the whole of
MyServer::tool_router(), which is
into_iter-able.
Sourcepub fn replace(&self, routes: impl IntoIterator<Item = ToolRoute<S>>)
pub fn replace(&self, routes: impl IntoIterator<Item = ToolRoute<S>>)
Replace the served tools, wholesale.
The only mutation there is. After this returns, the new set is
what a request will route against, and whoever is serving has
been told — which for serve means the
live router is rebuilt and the client is sent
notifications/tools/list_changed.
Wholesale rather than add/remove because a partial edit has to answer “what was there before?”, and a plugin deciding its tool set from its identity and arguments already knows the answer it wants — it does not want to diff its way there.
Trait Implementations§
Auto Trait Implementations§
impl<S> !Freeze for Tools<S>
impl<S> !RefUnwindSafe for Tools<S>
impl<S> !UnwindSafe for Tools<S>
impl<S> Send for Tools<S>
impl<S> Sync for Tools<S>
impl<S> Unpin for Tools<S>
impl<S> UnsafeUnpin for Tools<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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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