pub struct Fiber {
pub id: String,
pub state: Mutex<FiberState>,
pub required_coeffects: HashSet<String>,
pub satisfied_coeffects: Mutex<HashSet<String>>,
pub disposables: Mutex<DisposableList>,
pub clm_ast: Mutex<Option<Value>>,
}Expand description
A Cordis execution Fiber representing an isolated plugin, agent task, or service.
Fields§
§id: String§state: Mutex<FiberState>§required_coeffects: HashSet<String>§satisfied_coeffects: Mutex<HashSet<String>>§disposables: Mutex<DisposableList>§clm_ast: Mutex<Option<Value>>Implementations§
Source§impl Fiber
impl Fiber
pub fn new(id: impl Into<String>, required_coeffects: Vec<String>) -> Self
Sourcepub fn try_activate(&self) -> bool
pub fn try_activate(&self) -> bool
Checks if all declared coeffects are satisfied and transitions to ACTIVE.
Sourcepub fn satisfy_coeffect(&self, coeffect: &str) -> bool
pub fn satisfy_coeffect(&self, coeffect: &str) -> bool
Satisfies a specific coeffect requirement.
Sourcepub fn register_disposable<F>(&self, cleanup: F)
pub fn register_disposable<F>(&self, cleanup: F)
Registers a reversible cleanup effect with this fiber.
Sourcepub fn transition_to(&self, new_state: FiberState) -> Result<(), String>
pub fn transition_to(&self, new_state: FiberState) -> Result<(), String>
Explicitly transitions the Fiber to a new state.
Sourcepub fn get_state(&self) -> FiberState
pub fn get_state(&self) -> FiberState
Returns the current lifecycle state of the Fiber.
Sourcepub fn pause(&self) -> Result<(), String>
pub fn pause(&self) -> Result<(), String>
Pauses the fiber execution, preparing for HMR or state snapshot.
Sourcepub fn suspend(&self) -> Result<(), String>
pub fn suspend(&self) -> Result<(), String>
Suspends the fiber execution awaiting a delimited continuation.
Sourcepub fn resume(&self) -> Result<(), String>
pub fn resume(&self) -> Result<(), String>
Resumes the fiber execution from suspended state back to Active.
Auto Trait Implementations§
impl !Freeze for Fiber
impl Forget for Fiber
impl RefUnwindSafe for Fiber
impl Send for Fiber
impl Sync for Fiber
impl Unpin for Fiber
impl UnsafeUnpin for Fiber
impl UnwindSafe for Fiber
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