pub struct Randoms {
    pub id: usize,
    pub numbers: Vec<u64>,
}
Expand description

This represents a simple collection of random numbers which is hosted inside the thread pool

It is tied to a particular thread by the modulus of its id.

The interface that it supports is governed by its implementation of the PoolItem trait. This in turn needs to be supported by the use of two enums of supported requests and responses

It supports the following operations Init creates a new Random with an stack based store of random numbers Mean calculates the mean of the contained numbers Sum calculates the sum of the contained numbers

Fields§

§id: usize§numbers: Vec<u64>

Implementations§

Trait Implementations§

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

The implementation of this trait allows the Randoms struct to be used in the thread pool infrastructure

here

This is a struct that defines the message that will initiate a new instance of the struct within the thread pool Read more
This is the enum that will define that messaging api that can be used to communicate with instances of the struct It will be an enum where each variant will define a request/response pair of structs Read more
This function defines how a new struct will be created when it receives The Init message. It returns the created new instance of the struct Read more
This function is a hook that is called when the pool is shutting down.
The function called if an item with the specified is not found The default behaviour is to panic Read more
used for debug only; allows logging to output the name of the type
This method is called to optionally add tracing before each message is processed. The tracing is removed once the message is processed. If the tracing is being written to a file it is important that the file is not truncated Read more
This method provides any required tracing in the pool items thread pool threads This tracing is added when the thread is spawned and remains in place until the thread dies Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more