pub struct ChildConfig {
pub id: String,
pub script_path: Option<PathBuf>,
pub script_inline: Option<String>,
pub capabilities: Option<Capability>,
}Expand description
Configuration for spawning a child.
§Example
use orcs_component::ChildConfig;
use std::path::PathBuf;
// From file
let config = ChildConfig::from_file("worker-1", "scripts/worker.lua");
// From inline script
let config = ChildConfig::from_inline("worker-2", r#"
return {
run = function(input) return input end,
on_signal = function(sig) return "Handled" end,
}
"#);Fields§
§id: StringUnique identifier for the child.
script_path: Option<PathBuf>Path to the script file (for Lua children).
script_inline: Option<String>Inline script content (for Lua children).
capabilities: Option<Capability>Requested capabilities for the child.
None— inherit all of the parent’s capabilities (default).Some(caps)— request specific capabilities. The effective set isparent_caps & requested_caps(a child cannot exceed its parent).
Implementations§
Source§impl ChildConfig
impl ChildConfig
Sourcepub fn from_file(id: impl Into<String>, path: impl Into<PathBuf>) -> Self
pub fn from_file(id: impl Into<String>, path: impl Into<PathBuf>) -> Self
Creates a config for a child from a script file.
Sourcepub fn from_inline(id: impl Into<String>, script: impl Into<String>) -> Self
pub fn from_inline(id: impl Into<String>, script: impl Into<String>) -> Self
Creates a config for a child from inline script.
Sourcepub fn with_capabilities(self, caps: Capability) -> Self
pub fn with_capabilities(self, caps: Capability) -> Self
Sets the requested capabilities for this child.
The effective capabilities will be parent_caps & requested_caps.
Trait Implementations§
Source§impl Clone for ChildConfig
impl Clone for ChildConfig
Source§fn clone(&self) -> ChildConfig
fn clone(&self) -> ChildConfig
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 ChildConfig
impl Debug for ChildConfig
Source§impl<'de> Deserialize<'de> for ChildConfig
impl<'de> Deserialize<'de> for ChildConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChildConfig
impl RefUnwindSafe for ChildConfig
impl Send for ChildConfig
impl Sync for ChildConfig
impl Unpin for ChildConfig
impl UnsafeUnpin for ChildConfig
impl UnwindSafe for ChildConfig
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