pub struct SupervisorOptions { /* private fields */ }Expand description
Options used to configure a Supervisor.
Implementations§
Source§impl SupervisorOptions
impl SupervisorOptions
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Constructs a new instance of SupervisorOptions with the default values.
Examples found in repository?
examples/supervisor.rs (line 40)
30 async fn start(&self) -> Result<Pid, ExitReason> {
31 // Spawn two instances of `MyServer` with their own unique ids.
32 let children = [
33 MyServer::new().child_spec().id("server1"),
34 MyServer::new().child_spec().id("server2"),
35 ];
36
37 // Restart only the terminated child.
38 Supervisor::with_children(children)
39 .strategy(SupervisionStrategy::OneForOne)
40 .start_link(SupervisorOptions::new())
41 .await
42 }More examples
examples/registry.rs (line 79)
58 async fn start(&self) -> Result<Pid, ExitReason> {
59 // Spawn a registry that will take care of registering 'MySpace'.
60 let children = [
61 Registry::new("space-registry")
62 .with_start(|key| {
63 let RegistryKey::String(id) = key else {
64 panic!()
65 };
66
67 MySpace::new(id).start_link(GenServerOptions::new())
68 })
69 .with_shutdown(Shutdown::Infinity)
70 .child_spec(RegistryOptions::new())
71 .id("space-registry"),
72 ChildSpec::new("test-registry")
73 .start(move || async { Ok(Process::spawn(test_registry())) }),
74 ];
75
76 // Restart only the terminated child.
77 Supervisor::with_children(children)
78 .strategy(SupervisionStrategy::OneForOne)
79 .start_link(SupervisorOptions::new())
80 .await
81 }Trait Implementations§
Source§impl Clone for SupervisorOptions
impl Clone for SupervisorOptions
Source§fn clone(&self) -> SupervisorOptions
fn clone(&self) -> SupervisorOptions
Returns a duplicate 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 SupervisorOptions
impl Debug for SupervisorOptions
Source§impl Default for SupervisorOptions
impl Default for SupervisorOptions
Source§fn default() -> SupervisorOptions
fn default() -> SupervisorOptions
Returns the “default value” for a type. Read more
Source§impl From<SupervisorOptions> for GenServerOptions
impl From<SupervisorOptions> for GenServerOptions
Source§fn from(value: SupervisorOptions) -> Self
fn from(value: SupervisorOptions) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SupervisorOptions
impl RefUnwindSafe for SupervisorOptions
impl Send for SupervisorOptions
impl Sync for SupervisorOptions
impl Unpin for SupervisorOptions
impl UnwindSafe for SupervisorOptions
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