pub struct KernelHandle {
id: KernelId,
inner: Arc<dyn KernelHandleInner>,
}Expand description
Handle to a launched kernel.
Provides an ergonomic API for interacting with a kernel.
Fields§
§id: KernelIdKernel identifier.
inner: Arc<dyn KernelHandleInner>Inner implementation.
Implementations§
Source§impl KernelHandle
impl KernelHandle
Sourcepub fn new(id: KernelId, inner: Arc<dyn KernelHandleInner>) -> Self
pub fn new(id: KernelId, inner: Arc<dyn KernelHandleInner>) -> Self
Create a new kernel handle.
Sourcepub async fn deactivate(&self) -> Result<()>
pub async fn deactivate(&self) -> Result<()>
Deactivate the kernel.
Sourcepub async fn send<M: RingMessage>(&self, message: M) -> Result<()>
pub async fn send<M: RingMessage>(&self, message: M) -> Result<()>
Send a message to the kernel.
Sourcepub async fn send_envelope(&self, envelope: MessageEnvelope) -> Result<()>
pub async fn send_envelope(&self, envelope: MessageEnvelope) -> Result<()>
Send a raw envelope.
Sourcepub async fn receive(&self) -> Result<MessageEnvelope>
pub async fn receive(&self) -> Result<MessageEnvelope>
Receive a message from the kernel.
Sourcepub async fn receive_timeout(
&self,
timeout: Duration,
) -> Result<MessageEnvelope>
pub async fn receive_timeout( &self, timeout: Duration, ) -> Result<MessageEnvelope>
Receive a message with timeout.
Sourcepub fn try_receive(&self) -> Result<MessageEnvelope>
pub fn try_receive(&self) -> Result<MessageEnvelope>
Try to receive a message (non-blocking).
Sourcepub async fn call<M: RingMessage>(
&self,
message: M,
timeout: Duration,
) -> Result<MessageEnvelope>
pub async fn call<M: RingMessage>( &self, message: M, timeout: Duration, ) -> Result<MessageEnvelope>
Send request and wait for response (call pattern).
Sourcepub fn status(&self) -> KernelStatus
pub fn status(&self) -> KernelStatus
Get kernel status.
Sourcepub fn metrics(&self) -> KernelMetrics
pub fn metrics(&self) -> KernelMetrics
Get kernel metrics.
Sourcepub fn state(&self) -> KernelState
pub fn state(&self) -> KernelState
Get the current kernel state.
This is a convenience method that returns just the state from status().
Sourcepub async fn suspend(&self) -> Result<()>
pub async fn suspend(&self) -> Result<()>
Suspend (deactivate) the kernel.
This is an alias for deactivate() for more intuitive API usage.
Sourcepub async fn resume(&self) -> Result<()>
pub async fn resume(&self) -> Result<()>
Resume (activate) the kernel.
This is an alias for activate() for more intuitive API usage.
Sourcepub fn is_terminated(&self) -> bool
pub fn is_terminated(&self) -> bool
Check if the kernel has terminated.
Trait Implementations§
Source§impl Clone for KernelHandle
impl Clone for KernelHandle
Source§fn clone(&self) -> KernelHandle
fn clone(&self) -> KernelHandle
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for KernelHandle
impl !RefUnwindSafe for KernelHandle
impl Send for KernelHandle
impl Sync for KernelHandle
impl Unpin for KernelHandle
impl !UnwindSafe for KernelHandle
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.