pub trait CalculatorServerHandler<___T = Channel>where
___T: Transport,{
// Required methods
fn add(
&mut self,
request: Request<Add, ___T>,
responder: Responder<Add, ___T>,
) -> impl Future<Output = ()> + Send;
fn subtract(
&mut self,
request: Request<Subtract, ___T>,
responder: Responder<Subtract, ___T>,
) -> impl Future<Output = ()> + Send;
fn multiply(
&mut self,
request: Request<Multiply, ___T>,
responder: Responder<Multiply, ___T>,
) -> impl Future<Output = ()> + Send;
fn divide(
&mut self,
request: Request<Divide, ___T>,
responder: Responder<Divide, ___T>,
) -> impl Future<Output = ()> + Send;
fn pow(
&mut self,
request: Request<Pow, ___T>,
responder: Responder<Pow, ___T>,
) -> impl Future<Output = ()> + Send;
}Expand description
A server handler for the Calculator protocol.
See Calculator for more details.
Required Methods§
Sourcefn add(
&mut self,
request: Request<Add, ___T>,
responder: Responder<Add, ___T>,
) -> impl Future<Output = ()> + Send
fn add( &mut self, request: Request<Add, ___T>, responder: Responder<Add, ___T>, ) -> impl Future<Output = ()> + Send
Adds two numbers together and returns their sum.
For example, with a being 4.5 and b being 3.2, the response sum is
7.7.
- request
athe first number to be added. - request
bthe second number to be added.
- response
sumthe sum of a and b.
Sourcefn subtract(
&mut self,
request: Request<Subtract, ___T>,
responder: Responder<Subtract, ___T>,
) -> impl Future<Output = ()> + Send
fn subtract( &mut self, request: Request<Subtract, ___T>, responder: Responder<Subtract, ___T>, ) -> impl Future<Output = ()> + Send
Subtracts two numbers and returns their difference.
For example, with a being 7.7 and b being 3.2, the response
difference is 4.5
- request
athe number to be subracted from. - request
bthe number to subtract.
- response
differencethe difference betweenaandb.
Sourcefn multiply(
&mut self,
request: Request<Multiply, ___T>,
responder: Responder<Multiply, ___T>,
) -> impl Future<Output = ()> + Send
fn multiply( &mut self, request: Request<Multiply, ___T>, responder: Responder<Multiply, ___T>, ) -> impl Future<Output = ()> + Send
Multiplies two numbers and returns their product.
For example, with a being 1.5 and b being 2.0, the response
product is 3.0
- request
athe first number used to calculatorulate theproduct. - request
bthe second number used to calculatorulate theproduct.
- response
productthe result of multiplyingaandb.
Sourcefn divide(
&mut self,
request: Request<Divide, ___T>,
responder: Responder<Divide, ___T>,
) -> impl Future<Output = ()> + Send
fn divide( &mut self, request: Request<Divide, ___T>, responder: Responder<Divide, ___T>, ) -> impl Future<Output = ()> + Send
Divides one number by another and return the quotient.
For example with a dividend of 2.0 and a divisor of 4.0, the
response quotient is 0.5.
- request
dividendthe number to divide with. - request
divisorthe number to divide into.
- response
quotientthe result of dividing thedividendinto thedivisor.
Sourcefn pow(
&mut self,
request: Request<Pow, ___T>,
responder: Responder<Pow, ___T>,
) -> impl Future<Output = ()> + Send
fn pow( &mut self, request: Request<Pow, ___T>, responder: Responder<Pow, ___T>, ) -> impl Future<Output = ()> + Send
Takes base to the exponent and returns the power.
For example with a base of 3.0 and an exponent of 4.0, the response
power is 81.0.
- request
basethe number to multiply by itself. - request
exponentthe number of times to successively multiplybase.
- response
powerthe result of multiplyingbaseby itselfexponenttimes..
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.