pub trait LayerAttach:
'static
+ Send
+ Sync {
type Error: Into<Box<dyn Error + Send + Sync + 'static>>;
type Layer: LayerIo;
// Required method
fn attach(
self,
lower_layer_metadata: Option<DiskLayerMetadata>,
) -> impl Future<Output = Result<Self::Layer, Self::Error>> + Send;
}
Expand description
Transition a layer from an unattached type-state, into an attached
type-state, capable of performing LayerIo
.
Layers which do not require a type-state transition on-attach (e.g: those
which are pre-initialized with a fixed set of metadata) can simply implement
LayerIo
directly, and leverage the blanket-impl of impl<T: LayerIo> LayerAttach for T
which simply returns Self
during the state transition.
Required Associated Types§
Required Methods§
Sourcefn attach(
self,
lower_layer_metadata: Option<DiskLayerMetadata>,
) -> impl Future<Output = Result<Self::Layer, Self::Error>> + Send
fn attach( self, lower_layer_metadata: Option<DiskLayerMetadata>, ) -> impl Future<Output = Result<Self::Layer, Self::Error>> + Send
Invoked when the layer is being attached to a layer stack.
If the layer is being attached on-top of an existing layer,
lower_layer_metadata
can be used to initialize and/or reconfigure the
layer using the properties of the layer is is being stacked on-top of.
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.