Struct oasis_core_runtime::protocol::Protocol
source · pub struct Protocol { /* private fields */ }
Expand description
Runtime part of the runtime host protocol.
Implementations§
source§impl Protocol
impl Protocol
sourcepub fn get_config(&self) -> &Config
pub fn get_config(&self) -> &Config
The supplied runtime configuration.
sourcepub fn get_identity(&self) -> Option<&Arc<Identity>>
pub fn get_identity(&self) -> Option<&Arc<Identity>>
The runtime identity.
sourcepub fn get_runtime_id(&self) -> Namespace
pub fn get_runtime_id(&self) -> Namespace
The runtime identifier for this instance.
§Panics
Panics, if the host environment information is not set.
sourcepub fn get_host_info(&self) -> HostInfo
pub fn get_host_info(&self) -> HostInfo
The host environment information for this instance.
§Panics
Panics, if the host environment information is not set.
sourcepub fn call_host(&self, body: Body) -> Result<Body, Error>
pub fn call_host(&self, body: Body) -> Result<Body, Error>
Make a new request to the runtime host and wait for the response.
This is a blocking variant of call_host_async
.
§Panics
This function panics if called within an asynchronous execution context.
sourcepub async fn call_host_async(&self, body: Body) -> Result<Body, Error>
pub async fn call_host_async(&self, body: Body) -> Result<Body, Error>
Make a new request to the runtime host and wait for the response.
sourcepub fn send_response(&self, id: u64, body: Body) -> Result<()>
pub fn send_response(&self, id: u64, body: Body) -> Result<()>
Send an async response to a previous request back to the host.
sourcepub fn ensure_initialized(&self) -> Result<()>
pub fn ensure_initialized(&self) -> Result<()>
Ensure that the runtime is ready to process requests and fail otherwise.
Trait Implementations§
source§impl Host for Protocol
impl Host for Protocol
source§fn identity<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PublicKey, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn identity<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PublicKey, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the identity of the host node.
Auto Trait Implementations§
impl !Freeze for Protocol
impl !RefUnwindSafe for Protocol
impl Send for Protocol
impl Sync for Protocol
impl Unpin for Protocol
impl !UnwindSafe for Protocol
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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