Skip to main content

ActorRuntime

Struct ActorRuntime 

Source
pub struct ActorRuntime { /* private fields */ }
Expand description

Runtime state of an actor

Corresponds to Lean: structure ActorRuntime

Implementations§

Source§

impl ActorRuntime

Source

pub fn empty(capacity: usize) -> Self

Create empty actor runtime

Corresponds to Lean: def ActorRuntime.empty (capacity : Nat) : ActorRuntime

Source

pub fn can_receive(&self) -> bool

Check if actor can receive (mailbox not empty)

Corresponds to Lean: def ActorRuntime.can_receive (ar : ActorRuntime) : Bool

Source

pub fn can_send(&self, target_capacity: usize) -> bool

Check if actor can send (pending queue not full)

Corresponds to Lean: def ActorRuntime.can_send (ar : ActorRuntime) (targetCapacity : Nat) : Bool

Source

pub fn mailbox_has_space(&self) -> bool

Check if mailbox has space

Corresponds to Lean: def ActorRuntime.mailbox_has_space (ar : ActorRuntime) : Bool

Source

pub fn enqueue_pending(&self, msg: Message) -> Self

Enqueue message to pending

Corresponds to Lean: def ActorRuntime.enqueue_pending

Source

pub fn enqueue_pending_mut(&mut self, msg: Message)

Enqueue message to pending (mutating version)

Source

pub fn deliver(&self) -> Self

Deliver message from pending to mailbox

Corresponds to Lean: def ActorRuntime.deliver

Returns the new state. If pending is empty or mailbox is full, returns unchanged state.

Source

pub fn deliver_mut(&mut self) -> Result<bool, ActorError>

Deliver message from pending to mailbox (mutating version)

Returns Ok(true) if delivered, Ok(false) if mailbox full, Err if no pending.

§Errors

Returns ActorError::NoMessage if the pending queue is empty.

Source

pub fn consume(&self) -> (Self, Option<Message>)

Consume message from mailbox

Corresponds to Lean: def ActorRuntime.consume

Returns (new_state, Option<Message>).

Source

pub fn consume_mut(&mut self) -> Option<Message>

Consume message from mailbox (mutating version)

Source

pub fn set_blocked(&self, on: ActorId) -> Self

Set blocked state (for deadlock analysis)

Corresponds to Lean: def ActorRuntime.set_blocked

Source

pub fn set_blocked_mut(&mut self, on: ActorId)

Set blocked state (mutating version)

Source

pub fn unblock(&self) -> Self

Clear blocked state

Corresponds to Lean: def ActorRuntime.unblock

Source

pub fn unblock_mut(&mut self)

Clear blocked state (mutating version)

Source

pub fn blocked_on(&self) -> Option<ActorId>

Get the blocked-on actor (if any)

Source

pub fn is_blocked(&self) -> bool

Check if actor is blocked

Source

pub fn capacity(&self) -> usize

Get the capacity

Source

pub fn pending_len(&self) -> usize

Get the pending queue length

Source

pub fn mailbox_len(&self) -> usize

Get the mailbox length

Source

pub fn pending_send(&self) -> Option<&Message>

Get the pending send message

Source

pub fn set_pending_send(&mut self, msg: Option<Message>)

Set the pending send message

Trait Implementations§

Source§

impl Clone for ActorRuntime

Source§

fn clone(&self) -> ActorRuntime

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ActorRuntime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ActorRuntime

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.