Struct pavex::server::ServerConfiguration
source · pub struct ServerConfiguration { /* private fields */ }
Expand description
All the available options for customizing the behaviour of a Server
.
Refer to Server::set_config
for applying the configuration
you assembled.
Implementations§
source§impl ServerConfiguration
impl ServerConfiguration
sourcepub fn new() -> Self
pub fn new() -> Self
Initialize a new ServerConfiguration
using its default settings.
sourcepub fn set_n_workers(self, n: usize) -> Self
pub fn set_n_workers(self, n: usize) -> Self
Set the number of worker threads to be spawned. It must be greater than 0.
§Default
It relies on std::thread::available_parallelism
to determine the available parallelism.
On most platforms, this is the number of physical CPU cores available. If the available
parallelism cannot be determined, it defaults to 2.
§Logical vs physical Cores
If you’d prefer to match the number of logical cores instead, you can use the num_cpus
crate to acquire the logical core count instead.
sourcepub fn get_n_workers(&self) -> NonZeroUsize
pub fn get_n_workers(&self) -> NonZeroUsize
Get the number of worker threads to be spawned.
Trait Implementations§
source§impl Clone for ServerConfiguration
impl Clone for ServerConfiguration
source§fn clone(&self) -> ServerConfiguration
fn clone(&self) -> ServerConfiguration
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ServerConfiguration
impl Debug for ServerConfiguration
Auto Trait Implementations§
impl Freeze for ServerConfiguration
impl RefUnwindSafe for ServerConfiguration
impl Send for ServerConfiguration
impl Sync for ServerConfiguration
impl Unpin for ServerConfiguration
impl UnwindSafe for ServerConfiguration
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)