pub enum WorkerServiceCallback<T, Payload>{
OnlyRequest(Box<dyn FnMut(&mut Payload, T::Request) -> T::Response + Send>),
WithId(Box<dyn FnMut(&mut Payload, T::Request, RequestId) -> T::Response + Send>),
WithInfo(Box<dyn FnMut(&mut Payload, T::Request, ServiceInfo) -> T::Response + Send>),
}Expand description
An enum capturing the various possible function signatures for service
callbacks that can be used by a Worker.
The correct enum variant is deduced by the IntoWorkerServiceCallback trait.
Variants§
OnlyRequest(Box<dyn FnMut(&mut Payload, T::Request) -> T::Response + Send>)
A callback that only takes in the request value
WithId(Box<dyn FnMut(&mut Payload, T::Request, RequestId) -> T::Response + Send>)
A callback that takes in the request value and the ID of the request
WithInfo(Box<dyn FnMut(&mut Payload, T::Request, ServiceInfo) -> T::Response + Send>)
A callback that takes in the request value and all available
Trait Implementations§
Source§impl<T: Service, Payload: 'static + Send> From<WorkerServiceCallback<T, Payload>> for AnyServiceCallback<T, Payload>
impl<T: Service, Payload: 'static + Send> From<WorkerServiceCallback<T, Payload>> for AnyServiceCallback<T, Payload>
Source§fn from(value: WorkerServiceCallback<T, Payload>) -> Self
fn from(value: WorkerServiceCallback<T, Payload>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T, Payload> Freeze for WorkerServiceCallback<T, Payload>
impl<T, Payload> !RefUnwindSafe for WorkerServiceCallback<T, Payload>
impl<T, Payload> Send for WorkerServiceCallback<T, Payload>
impl<T, Payload> !Sync for WorkerServiceCallback<T, Payload>
impl<T, Payload> Unpin for WorkerServiceCallback<T, Payload>
impl<T, Payload> !UnwindSafe for WorkerServiceCallback<T, Payload>
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> 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