pub trait CalculatorServerHandler<___T: Transport = Channel> {
// Required methods
fn add(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Add, ___T>,
responder: Responder<Add>,
) -> impl Future<Output = ()> + Send;
fn subtract(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Subtract, ___T>,
responder: Responder<Subtract>,
) -> impl Future<Output = ()> + Send;
fn multiply(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Multiply, ___T>,
responder: Responder<Multiply>,
) -> impl Future<Output = ()> + Send;
fn divide(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Divide, ___T>,
responder: Responder<Divide>,
) -> impl Future<Output = ()> + Send;
fn pow(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Pow, ___T>,
responder: Responder<Pow>,
) -> impl Future<Output = ()> + Send;
}
Expand description
A server handler for the Calculator protocol.
See Calculator
for more details.
Required Methods§
Sourcefn add(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Add, ___T>,
responder: Responder<Add>,
) -> impl Future<Output = ()> + Send
fn add( &mut self, sender: &ServerSender<Calculator, ___T>, request: Request<Add, ___T>, responder: Responder<Add>, ) -> 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
a
the first number to be added. - request
b
the second number to be added.
- response
sum
the sum of a and b.
Sourcefn subtract(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Subtract, ___T>,
responder: Responder<Subtract>,
) -> impl Future<Output = ()> + Send
fn subtract( &mut self, sender: &ServerSender<Calculator, ___T>, request: Request<Subtract, ___T>, responder: Responder<Subtract>, ) -> 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
a
the number to be subracted from. - request
b
the number to subtract.
- response
difference
the difference betweena
andb
.
Sourcefn multiply(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Multiply, ___T>,
responder: Responder<Multiply>,
) -> impl Future<Output = ()> + Send
fn multiply( &mut self, sender: &ServerSender<Calculator, ___T>, request: Request<Multiply, ___T>, responder: Responder<Multiply>, ) -> 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
a
the first number used to calculatorulate theproduct
. - request
b
the second number used to calculatorulate theproduct
.
- response
product
the result of multiplyinga
andb
.
Sourcefn divide(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Divide, ___T>,
responder: Responder<Divide>,
) -> impl Future<Output = ()> + Send
fn divide( &mut self, sender: &ServerSender<Calculator, ___T>, request: Request<Divide, ___T>, responder: Responder<Divide>, ) -> 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
dividend
the number to divide with. - request
divisor
the number to divide into.
- response
quotient
the result of dividing thedividend
into thedivisor
.
Sourcefn pow(
&mut self,
sender: &ServerSender<Calculator, ___T>,
request: Request<Pow, ___T>,
responder: Responder<Pow>,
) -> impl Future<Output = ()> + Send
fn pow( &mut self, sender: &ServerSender<Calculator, ___T>, request: Request<Pow, ___T>, responder: Responder<Pow>, ) -> 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
base
the number to multiply by itself. - request
exponent
the number of times to successively multiplybase
.
- response
power
the result of multiplyingbase
by itselfexponent
times..
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.