[][src]Trait exonum::runtime::SnapshotExt

pub trait SnapshotExt {
    fn for_core(&self) -> CoreSchema<&dyn Snapshot>;
fn for_dispatcher(&self) -> DispatcherSchema<&dyn Snapshot>;
fn for_service<'q>(
        &self,
        id: impl Into<InstanceQuery<'q>>
    ) -> Option<Prefixed<&dyn Snapshot>>;
fn service_schema<'s, 'q, S, I>(
        &'s self,
        service_id: I
    ) -> Result<S, ArtifactReqError>
    where
        S: RequireArtifact + FromAccess<Prefixed<&'s dyn Snapshot>>,
        I: Into<InstanceQuery<'q>>
; }

Extension trait for Snapshot allowing to access blockchain data in a more structured way.

Required methods

fn for_core(&self) -> CoreSchema<&dyn Snapshot>

Returns core schema.

fn for_dispatcher(&self) -> DispatcherSchema<&dyn Snapshot>

Returns dispatcher schema.

fn for_service<'q>(
    &self,
    id: impl Into<InstanceQuery<'q>>
) -> Option<Prefixed<&dyn Snapshot>>

Returns a mount point for a service. If the service does not exist, returns None.

Safety

This method does not check the service type; the caller is responsible for constructing a schema of a correct type around the returned access. Constructing an incorrect schema can lead to a panic or unexpected behavior. Use service_schema as a safer alternative, which performs all necessary checks.

fn service_schema<'s, 'q, S, I>(
    &'s self,
    service_id: I
) -> Result<S, ArtifactReqError> where
    S: RequireArtifact + FromAccess<Prefixed<&'s dyn Snapshot>>,
    I: Into<InstanceQuery<'q>>, 

Retrieves schema for a service.

Errors

Returns an error in the following situations (see ArtifactReqError for more details):

  • Service with the given ID does not exist
  • Service has an unexpected artifact name
  • Service has an incompatible artifact version
Loading content...

Implementations on Foreign Types

impl SnapshotExt for dyn Snapshot[src]

Loading content...

Implementors

Loading content...