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§
Sourcefn for_core(&self) -> CoreSchema<&dyn Snapshot>
fn for_core(&self) -> CoreSchema<&dyn Snapshot>
Returns core schema.
Sourcefn for_dispatcher(&self) -> DispatcherSchema<&dyn Snapshot>
fn for_dispatcher(&self) -> DispatcherSchema<&dyn Snapshot>
Returns dispatcher schema.
Sourcefn for_service<'q>(
&self,
id: impl Into<InstanceQuery<'q>>,
) -> Option<Prefixed<&dyn Snapshot>>
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.
Sourcefn service_schema<'s, 'q, S, I>(
&'s self,
service_id: I,
) -> Result<S, ArtifactReqError>
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.