pub(crate) async fn load_state<T>(self, key: Cow<'static, [u8]>) -> Option<T>
    where
        REv: From<StateStoreRequest>,
        for<'de> T: Deserialize<'de>,
    {
        // Due to object safety issues, we cannot ship the actual values around, but only the
        // serialized bytes. Hence we retrieve raw bytes from storage and then deserialize here.
        self.make_request(
            move |responder| StateStoreRequest::Load { key, responder },
            QueueKind::Regular,
        )
        .await
        .map(|data| bincode::deserialize(&data))
        .transpose()
        .unwrap_or_else(|err| {
            let type_name = type_name::<T>();
            error!(%type_name, %err, "could not deserialize state from storage");
            None
        })
    }
/// Loads potentially previously stored state from storage.
///
/// Key must be a unique key across the the application, as all keys share a common namespace.
///
/// If an error occurs during state loading or no data is found, returns `None`.
Loads potentially previously stored state from storage.
Key must be a unique key across the the application, as all keys share a common namespace.

If an error occurs during state loading or no data is found, returns `None`.
Loads potentially previously stored state from storage . Key must be a unique key across the the application as all keys share a common namespace . If an error occurs during state loading or no data is found returns ` None ` .
pub(crate) async fn load_state<T>(self, key: Cow<'static, [u8]>) -> Option<T>
    where
        REv: From<StateStoreRequest>,
        for<'de> T: Deserialize<'de>,
    {
        // Due to object safety issues, we cannot ship the actual values around, but only the
        // serialized bytes. Hence we retrieve raw bytes from storage and then deserialize here.
        self.make_request(
            move |responder| StateStoreRequest::Load { key, responder },
            QueueKind::Regular,
        )
        .await
        .map(|data| bincode::deserialize(&data))
        .transpose()
        .unwrap_or_else(|err| {
            let type_name = type_name::<T>();
            error!(%type_name, %err, "could not deserialize state from storage");
            None
        })
    }
pub ( crate ) async fn load_state < T > ( self , key : Cow < ' static , [ u8 ] > ) -> Option < T > where REv : From < StateStoreRequest > , for < ' de > T : Deserialize < ' de > , { // Due to object safety issues, we cannot ship the actual values around, but only the // serialized bytes. Hence we retrieve raw bytes from storage and then deserialize here. self . make_request ( move | responder | StateStoreRequest :: Load { key , responder } , QueueKind :: Regular , ) . await . map ( | data | bincode :: deserialize ( & data ) ) . transpose ( ) . unwrap_or_else ( | err | { let type_name = type_name :: < T > ( ) ; error ! ( type_name err " " ) ; None } ) }
Loads potentially previously stored state from storage.
Loads potentially previously stored state from storage .
self
key
Cow<'static, [u8]>
self
key
Cow<'static, [u8]>