Trait SnapshotExt

Source
pub trait SnapshotExt {
    // Required methods
    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>>;
}
Expand description

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

Required Methods§

Source

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

Returns core schema.

Source

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

Returns dispatcher schema.

Source

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.

Source

fn service_schema<'s, 'q, S, I>( &'s self, service_id: I, ) -> Result<S, ArtifactReqError>

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SnapshotExt for dyn Snapshot

Source§

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

Source§

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

Source§

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

Source§

fn service_schema<'s, 'q, S, I>( &'s self, service_id: I, ) -> Result<S, ArtifactReqError>

Implementors§