lightclient: Use generic TPlat for chainSuccess

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2024-04-03 19:09:08 +03:00
parent 644626f77e
commit b91742a647
3 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -108,7 +108,7 @@ impl BackgroundTaskHandle {
/// coming to/from Smoldot.
#[allow(clippy::type_complexity)]
pub struct BackgroundTask<TPlatform: PlatformRef, TChain> {
channels: BackgroundTaskChannels,
channels: BackgroundTaskChannels<TPlatform>,
data: BackgroundTaskData<TPlatform, TChain>,
}
@@ -117,7 +117,7 @@ impl<TPlatform: PlatformRef, TChain> BackgroundTask<TPlatform, TChain> {
pub(crate) fn new(
client: SharedClient<TPlatform, TChain>,
chain_id: smoldot_light::ChainId,
from_back: smoldot_light::JsonRpcResponses,
from_back: smoldot_light::JsonRpcResponses<TPlatform>,
) -> (BackgroundTask<TPlatform, TChain>, BackgroundTaskHandle) {
let (tx, rx) = mpsc::unbounded_channel();
@@ -191,11 +191,11 @@ impl<TPlatform: PlatformRef, TChain> BackgroundTask<TPlatform, TChain> {
}
}
struct BackgroundTaskChannels {
struct BackgroundTaskChannels<TPlatform: PlatformRef> {
/// Messages sent into this background task from the front end.
from_front: UnboundedReceiverStream<Message>,
/// Messages sent into the background task from Smoldot.
from_back: smoldot_light::JsonRpcResponses,
from_back: smoldot_light::JsonRpcResponses<TPlatform>,
}
struct BackgroundTaskData<TPlatform: PlatformRef, TChain> {
+1 -1
View File
@@ -185,7 +185,7 @@ impl LightClientRpc {
pub(crate) fn new_raw<TPlat, TChain>(
client: impl Into<SharedClient<TPlat, TChain>>,
chain_id: smoldot_light::ChainId,
rpc_responses: smoldot_light::JsonRpcResponses,
rpc_responses: smoldot_light::JsonRpcResponses<TPlat>,
) -> Self
where
TPlat: smoldot_light::platform::PlatformRef + Send + 'static,
+1 -1
View File
@@ -38,7 +38,7 @@ impl<TPlat: sl::platform::PlatformRef, TChain> SharedClient<TPlat, TChain> {
pub(crate) fn add_chain(
&self,
config: sl::AddChainConfig<'_, TChain, impl Iterator<Item = sl::ChainId>>,
) -> Result<sl::AddChainSuccess, sl::AddChainError> {
) -> Result<sl::AddChainSuccess<TPlat>, sl::AddChainError> {
self.client
.lock()
.expect("mutex should not be poisoned")