pub struct ActionDispatcher { /* private fields */ }Expand description
Looks up an ActionRequest’s action against the capability catalog and
runs it against the official, internal, or hybrid API as appropriate.
Holds one UnifiClient (and therefore one pooled reqwest::Client) for
its lifetime — construct once per controller and reuse it across calls
rather than rebuilding per execute call.
Implementations§
Source§impl ActionDispatcher
impl ActionDispatcher
Sourcepub fn new(client: UnifiClient) -> Self
pub fn new(client: UnifiClient) -> Self
Wraps an already-built UnifiClient.
Sourcepub async fn execute(&self, request: ActionRequest) -> Result<Value>
pub async fn execute(&self, request: ActionRequest) -> Result<Value>
Runs request against whichever API family its action belongs to.
§Errors
Returns UnifiError::UnknownAction if request.action has no
registered capability; see UnifiError for the other failure cases
this can return.
Auto Trait Implementations§
impl Freeze for ActionDispatcher
impl !RefUnwindSafe for ActionDispatcher
impl Send for ActionDispatcher
impl Sync for ActionDispatcher
impl Unpin for ActionDispatcher
impl UnsafeUnpin for ActionDispatcher
impl !UnwindSafe for ActionDispatcher
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