Struct mioco::Config [] [src]

pub struct Config { /* fields omitted */ }

Mioco instance builder.

Methods

impl Config
[src]

Create mioco Config.

Use it to configure mioco instance.

See start() and start_threads() for convenience wrappers.

Set numer of threads to run mioco with

Default is equal to a numer of CPUs in the system.

Set custom scheduler.

See Scheduler trait.

Default is a simple FIFO-scheduler that spreads all the new coroutines between all threads in round-robin fashion, and runs them in FIFO manner.

See private FifoSchedule source for details.

Set stack size in bytes.

Default is 2MiB.

Should be a power of 2.

Stack size includes a protection page. Setting too small stack will lead to SEGFAULTs. See context-rs stack.rs for implementation details. The sane minimum seems to be 128KiB, which is two 64KB pages.

Set user-provided data for the first coroutine

See set_userdata.

Configure mio::EvenLoop for all the threads

Set if this instance will be catching panics, that occur within the coroutines

  • If true mioco will gracefully handle panics inside coroutines. (default)
  • If false any panic inside coroutine will panic the whole mioco instance.

Set if this instance should use protected stacks (default).

Unprotected stacks can be used to skip creation of stack guard page. This is useful when hitting OS limits regarding process mappings. It's better idea to fix it at the OS level, but eg. for automated testing it might be useful.

Trait Implementations

impl Default for Config
[src]

Returns the "default value" for a type. Read more